Making WordPress.org


Ignore:
Timestamp:
09/08/2016 09:55:13 PM (8 years ago)
Author:
ocean90
Message:

Translate, Plugin Directory: Trigger a build event for a language pack when a translation is updated or originals were imported.

Builds are delayed by 30 minutes. The listener comes tomorrow.

File:
1 edited

Legend:

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

    r3603 r4011  
    66use GP_Locales;
    77use GP_Translation;
     8use WordPressdotorg\GlotPress\Plugin_Directory\Plugin;
    89
    910class Translation_Sync {
    10     public $master_project = 'wp-plugins';
    1111
    1212    private $queue = array();
     
    4444
    4545        $project = GP::$project->get( $project_id );
    46         if ( ! $project || ! $this->project_is_plugin( $project->path ) ) {
     46        if ( ! $project || ! Plugin::project_is_plugin( $project->path ) ) {
    4747            return;
    4848        }
     
    7575     */
    7676    public function sync_plugin_translations_on_commit( $args ) {
    77         $project = GP::$project->by_path( $this->master_project . '/' . $args['gp_project'] );
     77        $project = GP::$project->by_path( Plugin::GP_MASTER_PROJECT . '/' . $args['gp_project'] );
    7878        if ( ! $project ) {
    7979            return false;
     
    151151        }
    152152
    153         if ( ! $this->project_is_plugin( $project->path ) ) {
     153        if ( ! Plugin::project_is_plugin( $project->path ) ) {
    154154            return;
    155155        }
     
    290290
    291291    /**
    292      * Returns whether a project path belongs to the plugins project.
    293      *
    294      * @param string $path Path of a project.
    295      *
    296      * @return bool True if it's a plugin, false if not.
    297      */
    298     public function project_is_plugin( $path ) {
    299         if ( empty( $path ) ) {
    300             return false;
    301         }
    302 
    303         $path = '/' . trim( $path, '/' ) . '/';
    304         if ( false === strpos( $path, "/{$this->master_project}/" ) ) {
    305             return false;
    306         }
    307 
    308         return true;
    309     }
    310 
    311     /**
    312292     * Sends a notifcation to the the Slack channel.
    313293     *
Note: See TracChangeset for help on using the changeset viewer.