Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions features/core-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,38 @@ Feature: Update WordPress core
"""
Success:
"""

Scenario: No HTML output from async translation updates during core update
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 --version=latest --force`
Then STDOUT should not contain:
"""
<p>
"""
And STDOUT should not contain:
"""
<div
"""
And STDOUT should not contain:
"""
<script
"""
And STDOUT should not contain:
"""
</div>
"""
9 changes: 9 additions & 0 deletions src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,15 @@ public function update( $args, $assoc_args ) {

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

// Prevent async translation updates which output HTML.
add_action(
'upgrader_process_complete',
function () {
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
},
1
);

if ( $update->version ) {
WP_CLI::log( "Updating to version {$update->version} ({$update->locale})..." );
} else {
Expand Down
Loading