From fa10069c5ec0090db3e3ba2ed02dab365df0ee59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:43:59 +0000 Subject: [PATCH 1/4] Initial plan From 6c3bce706aaf049d1602f3f21ad376769ce8fcbb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:57:24 +0000 Subject: [PATCH 2/4] Fix wp core update to honor --locale flag and allow locale-change updates without --force Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/core-update.feature | 37 ++++++++++++++++++++++++++++++++++++ src/Core_Command.php | 29 +++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/features/core-update.feature b/features/core-update.feature index c8edc83c..228ca817 100644 --- a/features/core-update.feature +++ b/features/core-update.feature @@ -420,6 +420,43 @@ Feature: Update WordPress core """ + Scenario: Update WordPress locale without --force when version is the same + Given a WP install + And an empty cache + + # Using `try` in case there are checksum warnings. + When I try `wp core download --version=6.5 --locale=de_DE --force` + Then STDOUT should contain: + """ + Success: WordPress downloaded. + """ + + When I run `wp core version --extra` + Then STDOUT should contain: + """ + Package language: de_DE + """ + + When I run `wp core version` + Then save STDOUT as {CURRENT_VERSION} + + # Updating to the same version with a different locale should work without --force. + When I run `wp core update --version={CURRENT_VERSION} --locale=en_US` + Then STDOUT should contain: + """ + Updating to version {CURRENT_VERSION} (en_US)... + """ + And STDOUT should contain: + """ + Success: WordPress updated successfully. + """ + + When I run `wp core version --extra` + Then STDOUT should contain: + """ + Package language: en_US + """ + @require-php-7.0 @require-wp-6.1 Scenario: Attempting to downgrade without --force shows helpful message Given a WP install diff --git a/src/Core_Command.php b/src/Core_Command.php index 13eb9143..03542b08 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -1178,7 +1178,7 @@ public function update( $args, $assoc_args ) { wp_version_check(); /** - * @var object{updates: array} $from_api + * @var object{updates: array} $from_api */ $from_api = get_site_transient( 'update_core' ); @@ -1198,9 +1198,31 @@ public function update( $args, $assoc_args ) { } elseif ( ! empty( $from_api->updates ) ) { list( $update ) = $from_api->updates; } + + // Override the locale in the transient-based update if --locale is explicitly specified. + if ( ! empty( $update ) ) { + $locale_arg = Utils\get_flag_value( $assoc_args, 'locale' ); + if ( $locale_arg ) { + $new_package = $this->get_download_url( $update->version, $locale_arg ); + $update = (object) [ + 'response' => $update->response, + 'current' => $update->version, + 'download' => $new_package, + 'packages' => (object) [ + 'partial' => null, + 'new_bundled' => $update->packages->new_bundled, + 'no_content' => null, + 'full' => $new_package, + ], + 'version' => $update->version, + 'locale' => $locale_arg, + ]; + } + } } elseif ( Utils\wp_version_compare( $assoc_args['version'], '<' ) || 'nightly' === $assoc_args['version'] - || Utils\get_flag_value( $assoc_args, 'force' ) ) { + || Utils\get_flag_value( $assoc_args, 'force' ) + || ! empty( $assoc_args['locale'] ) ) { // Specific version is given $version = $assoc_args['version']; @@ -1230,7 +1252,8 @@ public function update( $args, $assoc_args ) { if ( ! empty( $update ) && ( $update->version !== $wp_version - || Utils\get_flag_value( $assoc_args, 'force' ) ) ) { + || Utils\get_flag_value( $assoc_args, 'force' ) + || ( $update->locale ?: 'en_US' ) !== ( self::get_wp_details()['wp_local_package'] ?: 'en_US' ) ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; From 8408944a0522d65416ebe169564a90a7f14dcfa4 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 25 Feb 2026 20:30:46 +0100 Subject: [PATCH 3/4] Update src/Core_Command.php --- src/Core_Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core_Command.php b/src/Core_Command.php index 03542b08..98e5c529 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -1205,12 +1205,12 @@ public function update( $args, $assoc_args ) { if ( $locale_arg ) { $new_package = $this->get_download_url( $update->version, $locale_arg ); $update = (object) [ - 'response' => $update->response, + 'response' => $update->response ?? 'upgrade', 'current' => $update->version, 'download' => $new_package, 'packages' => (object) [ 'partial' => null, - 'new_bundled' => $update->packages->new_bundled, + 'new_bundled' => $update->packages->new_bundled ?? null, 'no_content' => null, 'full' => $new_package, ], From 59f09885a402fea4f7129c192cc63dcd2fd1e36f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 25 Feb 2026 22:16:08 +0100 Subject: [PATCH 4/4] Update features/core-update.feature Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- features/core-update.feature | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/features/core-update.feature b/features/core-update.feature index 228ca817..021fddfc 100644 --- a/features/core-update.feature +++ b/features/core-update.feature @@ -457,6 +457,34 @@ Feature: Update WordPress core Package language: en_US """ + Scenario: Update WordPress locale when using --minor + Given a WP install + And an empty cache + + # Using `try` in case there are checksum warnings. + When I try `wp core download --version=6.5 --locale=de_DE --force` + Then STDOUT should contain: + """ + Success: WordPress downloaded. + """ + + When I run `wp core version --extra` + Then STDOUT should contain: + """ + Package language: de_DE + """ + + When I run `wp core update --minor --locale=en_US` + Then STDOUT should contain: + """ + Success: WordPress updated successfully. + """ + + When I run `wp core version --extra` + Then STDOUT should contain: + """ + Package language: en_US + """ @require-php-7.0 @require-wp-6.1 Scenario: Attempting to downgrade without --force shows helpful message Given a WP install