Making WordPress.org

Changeset 5488


Ignore:
Timestamp:
05/14/2017 09:23:41 PM (9 years ago)
Author:
ocean90
Message:

Plugin Directory: Replace shell_exec()/system() calls with exec().

Avoids printing the CLI output to stdout.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/i18n/class-i18n-import.php

    r5444 r5488  
    7575        $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate set-plugin-project ' . escapeshellarg( $plugin_slug ) . ' ' . escapeshellarg( $process_type );
    7676
    77         $last_line = system( $cmd, $return_code );
     77        $return_code = 0;
     78        $output = [];
     79        exec( $cmd, $output, $return_code );
     80        $last_line = array_pop( $output );
    7881
    7982        if ( 0 === $return_code ) {
     
    122125        // Note: this will only work if the GlotPress project/sub-projects exist.
    123126        $cmd = WPORGTRANSLATE_WPCLI . ' glotpress import-originals ' . escapeshellarg( "wp-plugins/{$project}/{$branch}" ) . ' ' . escapeshellarg( $file );
    124         echo shell_exec( $cmd ) . "\n";
     127        exec( $cmd );
    125128
    126129        if ( empty( $str_priorities ) ) {
     
    228231
    229232            $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate import-plugin-translations ' . escapeshellarg( "wp-plugins/{$project}/{$branch}" ) . ' ' . escapeshellarg( $language ) . ' ' . escapeshellarg( $file ) . ' --format=' . escapeshellarg( $ext );
    230             echo shell_exec( $cmd . ' 2>&1' );
     233            exec( $cmd );
    231234        }
    232235    }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-i18n-import.php

    r5458 r5488  
    110110
    111111            $cmd = self::PHP . ' ' . dirname( __DIR__ ) . "/bin/import-plugin-to-glotpress.php --plugin {$esc_plugin_slug} --tag {$esc_tag} --type {$esc_type}";
    112 
    113             echo "\n\$$cmd\n";
    114             echo shell_exec( $cmd ) . "\n";
     112            exec( $cmd );
    115113        }
    116114    }
    117 
    118115}
Note: See TracChangeset for help on using the changeset viewer.