Making WordPress.org


Ignore:
Timestamp:
09/09/2016 07:47:55 PM (10 years ago)
Author:
ocean90
Message:

Translate, Theme Directory: Add trigger and listener to build theme language packs.

The build event, which is delayed by 30 minutes after a translation change, is triggered by the Cron API (Cavalcade).
[3953] introduced the WP-CLI command for this.

See [4015] for plugins.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-theme-directory/inc/class-plugin.php

    r3057 r4024  
    1313
    1414        /**
    15          *
    16          * @var Sync\Translation_Sync
     15         * Parent project for themes.
    1716         */
    18         public $translation_sync = null;
     17        const GP_MASTER_PROJECT = 'wp-themes';
    1918
    2019        /**
    … …  
    4241        public function plugins_loaded() {
    4342                add_action( 'wporg_translate_import_or_update_theme', array( $this, 'import_or_update_theme_on_status_change' ) );
     43
     44                $language_pack_build_trigger = new Language_Pack\Build_Trigger();
     45                $language_pack_build_trigger->register_events();
     46
     47                $language_pack_build_listener = new Language_Pack\Build_Listener(
     48                        Language_Pack\Build_Trigger::HOOK
     49                );
     50                $language_pack_build_listener->register_events();
    4451
    4552                if ( defined( 'WP_CLI' ) && WP_CLI ) {
    … …  
    94101
    95102        /**
     103         * Returns whether a project path belongs to the themes project.
     104         *
     105         * @param string $path Path of a project.
     106         *
     107         * @return bool True if it's a theme, false if not.
     108         */
     109        public static function project_is_theme( $path ) {
     110                if ( empty( $path ) ) {
     111                        return false;
     112                }
     113
     114                $path = '/' . trim( $path, '/' ) . '/';
     115                if ( false === strpos( $path, '/' . self::GP_MASTER_PROJECT . '/' ) ) {
     116                        return false;
     117                }
     118
     119                return true;
     120        }
     121
     122        /**
    96123         * Sends a notifcation to the the Slack channel.
    97124         *
Note: See TracChangeset for help on using the changeset viewer.