OSDN Git Service

core download: refactor curl + tar into a single command string
authorscribu <mail@scribu.net>
Mon, 29 Apr 2013 16:29:55 +0000 (19:29 +0300)
committerscribu <mail@scribu.net>
Mon, 29 Apr 2013 16:29:59 +0000 (19:29 +0300)
php/commands/core.php

index 391ba14..d3f13b7 100644 (file)
@@ -34,11 +34,10 @@ class Core_Command extends WP_CLI_Command {
                        WP_CLI::line( sprintf( 'Downloading latest WordPress (%s)...', 'en_US' ) );
                }
 
-               $silent = WP_CLI::get_config('quiet') ? ' --silent ' : ' ';
+               $silent = WP_CLI::get_config('quiet') ? '--silent ' : '';
 
-               $curl_command = 'curl -f' . $silent . escapeshellarg( $download_url );
-               $tar_command = sprintf( 'tar xz --directory=%s --strip-components=1', escapeshellarg( ABSPATH ) );
-               WP_CLI::launch( $curl_command . ' | ' . $tar_command );
+               $cmd = "curl -f $silent %s | tar xz --strip-components=1 --directory=%s";
+               WP_CLI::launch( \WP_CLI\Utils\create_cmd( $cmd, $download_url, ABSPATH ) );
 
                WP_CLI::success( 'WordPress downloaded.' );
        }