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..e0eae8483 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 --ignore-domain', |
| 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..949410589 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( |
| 146 | sprintf( |
| 147 | 'wp i18n make-pot %s %s --ignore-domain', |
| 148 | escapeshellarg( $theme_dir ), |
| 149 | escapeshellarg( $pot_file ) |
| 150 | ) |
| 151 | ); |
161 | 152 | return $pot_file; |
162 | 153 | } |
163 | 154 | |
… |
… |
class Set_Theme_Project extends WP_CLI_Command { |
304 | 295 | return $data; |
305 | 296 | } |
306 | 297 | |
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 | 298 | /** |
319 | 299 | * Cleanup a theme directory, for when this is used in batch mode. |
320 | 300 | */ |