Skip to content

Commit ec52a45

Browse files
Pass args in expected order, and allow $data as an option too
1 parent 494cc3e commit ec52a45

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

php/WP_CLI/CoreUpgrader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function download_package( $package ) {
5656

5757
$this->skin->feedback( 'downloading_package', $package );
5858

59-
Utils\http_request( 'GET', $package, $headers, $options );
59+
Utils\http_request( 'GET', $package, null, $headers, $options );
6060
$cache->import( $cache_key, $temp );
6161
return $temp;
6262
}

php/commands/core.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function download( $args, $assoc_args ) {
7575
'filename' => $temp
7676
);
7777

78-
Utils\http_request( 'GET', $download_url, $headers, $options );
78+
Utils\http_request( 'GET', $download_url, null, $headers, $options );
7979
self::_extract( $temp, ABSPATH );
8080
$cache->import( $cache_key, $temp );
8181
unlink($temp);
@@ -136,7 +136,7 @@ private static function _rmdir( $dir ) {
136136

137137
private static function _read( $url ) {
138138
$headers = array('Accept' => 'application/json');
139-
return Utils\http_request( 'GET', $url, $headers )->body;
139+
return Utils\http_request( 'GET', $url, null, $headers )->body;
140140
}
141141

142142
private function get_download_offer( $locale ) {
@@ -659,11 +659,11 @@ private static function get_core_checksums( $version, $locale ) {
659659
$headers = array(
660660
'Accept' => 'application/json'
661661
);
662-
$response = Utils\http_request( 'GET', $url, $headers, $options );
662+
$response = Utils\http_request( 'GET', $url, null, $headers, $options );
663663

664664
if ( $ssl && ! $response->success ) {
665665
WP_CLI::warning( 'wp-cli could not establish a secure connection to WordPress.org. Please contact your server administrator.' );
666-
$response = Utils\http_request( 'GET', $http_url, $headers, $options );
666+
$response = Utils\http_request( 'GET', $http_url, null, $headers, $options );
667667
}
668668

669669
if ( ! $response->success || 200 != $response->status_code )

php/utils.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ function replace_path_consts( $source, $path ) {
411411
* @param array $options
412412
* @return object
413413
*/
414-
function http_request( $method, $url, $headers = array(), $options = array() ) {
414+
function http_request( $method, $url, $data = null, $headers = array(), $options = array() ) {
415415
$pem_copied = false;
416416

417417
// cURL can't read Phar archives
@@ -426,7 +426,7 @@ function http_request( $method, $url, $headers = array(), $options = array() ) {
426426
}
427427

428428
try {
429-
$request = \Requests::request( $url, null, $method, $headers, $options );
429+
$request = \Requests::request( $url, $headers, $data, $method, $options );
430430
if ( $pem_copied ) {
431431
unlink( $options['verify'] );
432432
}
@@ -439,7 +439,7 @@ function http_request( $method, $url, $headers = array(), $options = array() ) {
439439
}
440440
$options['verify'] = false;
441441
try {
442-
return \Requests::request( $url, null, $method, $headers, $options );
442+
return \Requests::request( $url, $headers, $data, $method, $options );
443443
} catch( \Requests_Exception $ex ) {
444444
\WP_CLI::error( $ex->getMessage() );
445445
}

0 commit comments

Comments
 (0)