You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run `wp option update core_updater.lock 100000000000000`
427
+
And I try `wp core update --version=trunk`
428
+
Then STDERR should contain:
429
+
"""
430
+
Another update is currently in progress. You may need to run `wp option delete core_updater.lock` after verifying another update isn't actually running.
Copy file name to clipboardExpand all lines: src/Core_Command.php
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1243,7 +1243,12 @@ static function () {
1243
1243
if ( is_wp_error( $result ) ) {
1244
1244
$message = WP_CLI::error_to_string( $result );
1245
1245
if ( 'up_to_date' !== $result->get_error_code() ) {
1246
-
WP_CLI::error( $message );
1246
+
// Check if the error is related to the core_updater.lock
1247
+
if ( self::is_lock_error( $result ) ) {
1248
+
WP_CLI::error( rtrim( $message, '.' ) . '. You may need to run `wp option delete core_updater.lock` after verifying another update isn\'t actually running.' );
1249
+
} else {
1250
+
WP_CLI::error( $message );
1251
+
}
1247
1252
} else {
1248
1253
WP_CLI::success( $message );
1249
1254
}
@@ -1684,4 +1689,21 @@ function () use ( $new_zip_file ) {
1684
1689
WP_CLI::error( 'ZipArchive failed to open ZIP file.' );
1685
1690
}
1686
1691
}
1692
+
1693
+
/**
1694
+
* Checks if a WP_Error is related to the core_updater.lock.
1695
+
*
1696
+
* @param \WP_Error $error The error object to check.
1697
+
* @return bool True if the error is related to the lock, false otherwise.
1698
+
*/
1699
+
privatestaticfunctionis_lock_error( $error ) {
1700
+
// Check for the 'locked' error code used by WordPress Core
1701
+
if ( 'locked' === $error->get_error_code() ) {
1702
+
returntrue;
1703
+
}
1704
+
1705
+
// Also check if the error message contains the lock text as a fallback
1706
+
$message = WP_CLI::error_to_string( $error );
1707
+
returnfalse !== stripos( $message, 'another update is currently in progress' );
0 commit comments