Changeset 3497 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php
- Timestamp:
- 06/20/2016 10:59:52 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php
r3373 r3497 12 12 class SVN_Watcher { 13 13 14 const SVN_URL = 'https://plugins.svn.wordpress.org/'; 15 const PHP = '/usr/local/bin/php'; 14 const SVN_URL = 'https://plugins.svn.wordpress.org/'; 15 const PHP = '/usr/local/bin/php'; 16 const PROCESS_I18N = false; 16 17 17 18 public function __construct() { … … 59 60 echo shell_exec( $cmd ) . "\n"; 60 61 61 if ( $this->process_i18n_for_plugin( $plugin_slug) && $plugin_data['readme_touched'] ) { 62 // TODO echo "import GlotPress readme\n"; 63 } 64 if ( $this->process_i18n_for_plugin( $plugin_slug) && $plugin_data['code_touched'] ) { 65 // TODO echo "import GlotPress code\n"; 62 if ( self::PROCESS_I18N ) { 63 $plugin = Plugin_Directory::get_plugin_post( $plugin_slug ); 64 $stable_tag = $plugin->stable_tag; 65 66 $i18n_processes = []; 67 if ( in_array( 'trunk', $plugin_data['tags_touched'] ) ) { 68 if ( $plugin_data['code_touched'] ) { 69 $i18n_processes[] = 'trunk|code'; 70 } 71 if ( $plugin_data['readme_touched'] ) { 72 $i18n_processes[] = 'trunk|readme'; 73 } 74 } 75 if ( in_array( $stable_tag, $plugin_data['tags_touched'] ) ) { 76 if ( $plugin_data['code_touched'] ) { 77 $i18n_processes[] = "{$stable_tag}|code"; 78 } 79 if ( $plugin_data['readme_touched'] ) { 80 $i18n_processes[] = "{$stable_tag}|readme"; 81 } 82 } 83 84 $this->process_i18n_for_plugin( $plugin_slug, $i18n_processes ); 66 85 } 67 86 … … 74 93 75 94 /** 76 * Determine Whether i18n processing is enabled for a plugin. 77 */ 78 protected function process_i18n_for_plugin( $plugin_slug ) { 79 return false; 95 * Processes i18n import tasks. 96 * 97 * @param string $plugin_slug 98 * @param array $i18n_processes 99 */ 100 protected function process_i18n_for_plugin( $plugin_slug, $i18n_processes ) { 101 foreach ( $i18n_processes as $process ) { 102 list( $tag, $type ) = explode( '|', $process ); 103 104 $esc_plugin_slug = escapeshellarg( $plugin_slug ); 105 $esc_tag = escapeshellarg( $tag ); 106 $esc_type = escapeshellarg( $type ); 107 108 $cmd = self::PHP . ' ' . dirname( __DIR__ ) . "/bin/import-plugin-to-glotpress.php --plugin {$esc_plugin_slug} --tag {$esc_tag} --type {$esc_type}"; 109 110 echo "\n\$$cmd\n"; 111 echo shell_exec( $cmd ) . "\n"; 112 } 80 113 } 81 114
Note: See TracChangeset
for help on using the changeset viewer.