diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/i18n/class-code-import.php wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/i18n/class-code-import.php
index cff90f2ae..9470cc6b9 100644
|
|
|
class Code_Import extends I18n_Import { |
| 42 | 42 | throw new Exception( 'Plugin is not compatible with language packs: ' . $valid->get_error_message() ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | | if ( ! class_exists( '\PotExtMeta' ) ) { |
| 46 | | require_once plugin_dir_path( \WordPressdotorg\Plugin_Directory\PLUGIN_FILE ) . 'libs/i18n-tools/makepot.php'; |
| 47 | | } |
| 48 | | |
| 49 | 45 | $pot_file = "{$tmp_directory}/{$this->plugin}-code.pot"; |
| 50 | | $makepot = new \MakePOT(); |
| 51 | 46 | |
| 52 | | if ( ! $makepot->wp_plugin( $export_directory, $pot_file, $this->plugin ) || ! file_exists( $pot_file ) ) { |
| | 47 | exec( |
| | 48 | sprintf( |
| | 49 | 'wp i18n make-pot %s %s --slug=%s', |
| | 50 | escapeshellarg( $export_directory ), |
| | 51 | escapeshellarg( $pot_file ), |
| | 52 | escapeshellarg( $this->plugin ) |
| | 53 | ), |
| | 54 | $output, |
| | 55 | $return_code |
| | 56 | ); |
| | 57 | |
| | 58 | if ( $return_code !== 0 || ! file_exists( $pot_file ) ) { |
| 53 | 59 | throw new Exception( "POT file couldn't be created." ); |
| 54 | 60 | } |
| 55 | 61 | |
diff --git wordpress.org/public_html/wp-content/plugins/wporg-gp-theme-directory/inc/cli/class-set-theme-project.php wordpress.org/public_html/wp-content/plugins/wporg-gp-theme-directory/inc/cli/class-set-theme-project.php
index 9feea2711..d11cd4bc8 100644
|
|
|
|
| 3 | 3 | namespace WordPressdotorg\GlotPress\Theme_Directory\CLI; |
| 4 | 4 | |
| 5 | 5 | use GP; |
| 6 | | use MakePOT; |
| 7 | 6 | use WordPressdotorg\GlotPress\Theme_Directory\Plugin; |
| 8 | 7 | use WP_CLI; |
| 9 | 8 | use WP_CLI_Command; |
| … |
… |
class Set_Theme_Project extends WP_CLI_Command { |
| 24 | 23 | */ |
| 25 | 24 | private $temp_dir; |
| 26 | 25 | |
| 27 | | /** |
| 28 | | * MakePot instance. |
| 29 | | * |
| 30 | | * @var MakePot |
| 31 | | */ |
| 32 | | private $makepot; |
| 33 | | |
| 34 | 26 | public function __construct() { |
| 35 | 27 | if ( ! file_exists( '/tmp/wporg-themes-i18n/' ) ) { |
| 36 | 28 | mkdir( '/tmp/wporg-themes-i18n/' ); |
| … |
… |
class Set_Theme_Project extends WP_CLI_Command { |
| 41 | 33 | if ( ! mkdir( $this->temp_dir ) ) { |
| 42 | 34 | WP_CLI::error( "Couldn't create temporary directory." ); |
| 43 | 35 | } |
| 44 | | |
| 45 | | $this->checkout_tools(); |
| 46 | | if ( ! file_exists( $this->temp_dir . '/i18n-tools/makepot.php' ) ) { |
| 47 | | WP_CLI::error( "Couldn't find MakePot." ); |
| 48 | | } |
| 49 | | require_once $this->temp_dir . '/i18n-tools/makepot.php'; |
| 50 | | $this->makepot = new MakePot(); |
| 51 | 36 | } |
| 52 | 37 | |
| 53 | 38 | /** |
| … |
… |
class Set_Theme_Project extends WP_CLI_Command { |
| 157 | 142 | */ |
| 158 | 143 | private function generate_pot( $theme_slug, $theme_dir ) { |
| 159 | 144 | $pot_file = "{$this->temp_dir}/{$theme_slug}.pot"; |
| 160 | | $this->makepot->wp_theme( $theme_dir, $pot_file ); |
| | 145 | WP_CLI::runcommand( sprintf( 'wp i18n make-pot %s %s', escapeshellarg( $theme_dir ), escapeshellarg( $pot_file ) ) ); |
| 161 | 146 | return $pot_file; |
| 162 | 147 | } |
| 163 | 148 | |
| … |
… |
class Set_Theme_Project extends WP_CLI_Command { |
| 304 | 289 | return $data; |
| 305 | 290 | } |
| 306 | 291 | |
| 307 | | /** |
| 308 | | * Creates an i18n-tools checkout so we have MakePot available. |
| 309 | | */ |
| 310 | | private function checkout_tools() { |
| 311 | | $tools_dir = "{$this->temp_dir}/i18n-tools/"; |
| 312 | | if ( ! file_exists( $tools_dir ) ) { |
| 313 | | $esc_tools_dir = escapeshellarg( $tools_dir ); |
| 314 | | `svn export --non-interactive https://i18n.svn.wordpress.org/tools/trunk {$esc_tools_dir}`; |
| 315 | | } |
| 316 | | } |
| 317 | | |
| 318 | 292 | /** |
| 319 | 293 | * Cleanup a theme directory, for when this is used in batch mode. |
| 320 | 294 | */ |