Making WordPress.org


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

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

Avoids printing the CLI output to stdout.

File:
1 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    }
Note: See TracChangeset for help on using the changeset viewer.