Skip to content

Commit 4cff09b

Browse files
committed
Remaining fixes
1 parent bd941c5 commit 4cff09b

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

features/core-update.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Feature: Update WordPress core
2121
"""
2222
Starting update...
2323
Unpacking the update...
24-
Cleaning up files...
2524
Success: WordPress updated successfully.
2625
"""
2726

src/Core_Command.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ private static function modify_wp_config( $content ) {
851851
$wp_config_path = Utils\locate_wp_config();
852852

853853
$token = "/* That's all, stop editing!";
854-
$config_contents = file_get_contents( $wp_config_path );
854+
$config_contents = (string) file_get_contents( $wp_config_path );
855855
if ( false === strpos( $config_contents, $token ) ) {
856856
return false;
857857
}
@@ -1121,6 +1121,10 @@ public function update( $args, $assoc_args ) {
11211121

11221122
// Update to next release
11231123
wp_version_check();
1124+
1125+
/**
1126+
* @var object{updates: array<object{version: string, locale: string}>} $from_api
1127+
*/
11241128
$from_api = get_site_transient( 'update_core' );
11251129

11261130
if ( Utils\get_flag_value( $assoc_args, 'minor' ) ) {
@@ -1185,7 +1189,12 @@ public function update( $args, $assoc_args ) {
11851189
$insecure = (bool) Utils\get_flag_value( $assoc_args, 'insecure', false );
11861190

11871191
$GLOBALS['wpcli_core_update_obj'] = $update;
1188-
$result = Utils\get_upgrader( $upgrader, $insecure )->upgrade( $update );
1192+
1193+
/**
1194+
* @var \WP_CLI\Core\CoreUpgrader $wp_upgrader
1195+
*/
1196+
$wp_upgrader = Utils\get_upgrader( $upgrader, $insecure );
1197+
$result = $wp_upgrader->upgrade( $update );
11891198
unset( $GLOBALS['wpcli_core_update_obj'] );
11901199

11911200
if ( is_wp_error( $result ) ) {
@@ -1379,6 +1388,10 @@ private function get_download_url( $version, $locale = 'en_US', $file_type = 'zi
13791388
private function get_updates( $assoc_args ) {
13801389
$force_check = (bool) Utils\get_flag_value( $assoc_args, 'force-check' );
13811390
wp_version_check( [], $force_check );
1391+
1392+
/**
1393+
* @var object{updates: array<object{version: string, locale: string, packages: object{partial?: string, full: string}}>}|false $from_api
1394+
*/
13821395
$from_api = get_site_transient( 'update_core' );
13831396
if ( ! $from_api ) {
13841397
return [];

src/WP_CLI/Core/CoreUpgrader.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public function download_package( $package, $check_signatures = false, $hook_ext
6666
$this,
6767
$hook_extra
6868
);
69+
70+
/**
71+
* @var false|string|\WP_Error $reply
72+
*/
73+
6974
if ( false !== $reply ) {
7075
return $reply;
7176
}
@@ -91,9 +96,13 @@ function () use ( $temp ) {
9196
}
9297
);
9398

94-
$cache = WP_CLI::get_cache();
95-
$update = $GLOBALS['wpcli_core_update_obj'];
96-
$cache_key = "core/{$filename}-{$update->locale}.{$extension}";
99+
$cache = WP_CLI::get_cache();
100+
$update = $GLOBALS['wpcli_core_update_obj'];
101+
$cache_key = "core/{$filename}-{$update->locale}.{$extension}";
102+
103+
/**
104+
* @var false|string $cache_file
105+
*/
97106
$cache_file = $cache->has( $cache_key );
98107

99108
if ( $cache_file && false === stripos( $package, 'https://wordpress.org/nightly-builds/' )
@@ -154,7 +163,7 @@ function () use ( $temp ) {
154163
* @type bool $do_rollback Whether to perform this "upgrade" as a rollback.
155164
* Default false.
156165
* }
157-
* @return null|false|WP_Error False or WP_Error on failure, null on success.
166+
* @return string|false|WP_Error New WordPress version on success, false or WP_Error on failure.
158167
*/
159168
public function upgrade( $current, $args = [] ) {
160169
set_error_handler( [ __CLASS__, 'error_handler' ], E_USER_WARNING | E_USER_NOTICE );

0 commit comments

Comments
 (0)