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
@@ -1258,7 +1258,12 @@ static function () {
1258
1258
if ( is_wp_error( $result ) ) {
1259
1259
$message = WP_CLI::error_to_string( $result );
1260
1260
if ( 'up_to_date' !== $result->get_error_code() ) {
1261
-
WP_CLI::error( $message );
1261
+
// Check if the error is related to the core_updater.lock
1262
+
if ( self::is_lock_error( $result ) ) {
1263
+
WP_CLI::error( rtrim( $message, '.' ) . '. You may need to run `wp option delete core_updater.lock` after verifying another update isn\'t actually running.' );
1264
+
} else {
1265
+
WP_CLI::error( $message );
1266
+
}
1262
1267
} else {
1263
1268
WP_CLI::success( $message );
1264
1269
}
@@ -1727,4 +1732,21 @@ function () use ( $new_zip_file ) {
1727
1732
WP_CLI::error( 'ZipArchive failed to open ZIP file.' );
1728
1733
}
1729
1734
}
1735
+
1736
+
/**
1737
+
* Checks if a WP_Error is related to the core_updater.lock.
1738
+
*
1739
+
* @param \WP_Error $error The error object to check.
1740
+
* @return bool True if the error is related to the lock, false otherwise.
1741
+
*/
1742
+
privatestaticfunctionis_lock_error( $error ) {
1743
+
// Check for the 'locked' error code used by WordPress Core
1744
+
if ( 'locked' === $error->get_error_code() ) {
1745
+
returntrue;
1746
+
}
1747
+
1748
+
// Also check if the error message contains the lock text as a fallback
1749
+
$message = WP_CLI::error_to_string( $error );
1750
+
returnfalse !== stripos( $message, 'another update is currently in progress' );
0 commit comments