WordPress.org

Making WordPress.org

Ticket #3748: 3748.3.diff

File 3748.3.diff, 1.3 KB (added by herregroen, 22 months ago)
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/i18n/class-code-import.php

    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 { 
    4242                        throw new Exception( 'Plugin is not compatible with language packs: ' . $valid->get_error_message() );
    4343                }
    4444
    45                 if ( ! class_exists( '\PotExtMeta' ) ) {
    46                         require_once plugin_dir_path( \WordPressdotorg\Plugin_Directory\PLUGIN_FILE ) . 'libs/i18n-tools/makepot.php';
    47                 }
    48 
    4945                $pot_file = "{$tmp_directory}/{$this->plugin}-code.pot";
    50                 $makepot  = new \MakePOT();
    5146
    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 ) ) {
    5359                        throw new Exception( "POT file couldn't be created." );
    5460                }
    5561