Skip to content

Commit b24507d

Browse files
authored
Merge pull request #298 from wp-cli/copilot/fix-html-output-update-wordpress
2 parents 855bb67 + 2a8236b commit b24507d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

features/core-update.feature

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,3 +384,38 @@ Feature: Update WordPress core
384384
"""
385385
Success:
386386
"""
387+
388+
Scenario: No HTML output from async translation updates during core update
389+
Given a WP install
390+
And an empty cache
391+
392+
# Using `try` in case there are checksum warnings.
393+
When I try `wp core download --version=6.5 --locale=de_DE --force`
394+
Then STDOUT should contain:
395+
"""
396+
Success: WordPress downloaded.
397+
"""
398+
399+
When I run `wp core version --extra`
400+
Then STDOUT should contain:
401+
"""
402+
Package language: de_DE
403+
"""
404+
405+
When I run `wp core update --version=latest --force`
406+
Then STDOUT should not contain:
407+
"""
408+
<p>
409+
"""
410+
And STDOUT should not contain:
411+
"""
412+
<div
413+
"""
414+
And STDOUT should not contain:
415+
"""
416+
<script
417+
"""
418+
And STDOUT should not contain:
419+
"""
420+
</div>
421+
"""

src/Core_Command.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,15 @@ public function update( $args, $assoc_args ) {
12131213

12141214
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
12151215

1216+
// Prevent async translation updates which output HTML.
1217+
add_action(
1218+
'upgrader_process_complete',
1219+
static function () {
1220+
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
1221+
},
1222+
1
1223+
);
1224+
12161225
if ( $update->version ) {
12171226
WP_CLI::log( "Updating to version {$update->version} ({$update->locale})..." );
12181227
} else {

0 commit comments

Comments
 (0)