core-command
core-command copied to clipboard
Unexpected HTML output when updating WordPress
If I update WP using wp core update I get a lot of unexpected HTML output coming from WordPress itself:
$ wp core update
Updating to version 4.0 (pt_BR)...
Descompactando a atualização...
<p>Algumas traduções precisam de atualização. Descanse por mais alguns segundos, enquanto atualizamos elas também.</p>
<div class="update-messages lp-show-latest"><h4>Atualizando traduções de WordPress (pt_BR)…</h4><p>Fazendo download da tradução de <span class="code">(http://downloads.wordpress.org/translation/core/4.0/pt_BR.zip)</span>…</p>
<p>Descompactando a atualização…</p>
<p>Instalando a versão mais recente…</p>
<p>Tradução atualizada com sucesso.</p>
</div><script type="text/javascript">
(function( wp ) {
if ( wp && wp.updates.decrementCount ) {
wp.updates.decrementCount( "translation" );
}
})( window.wp );
</script></div></div>Success: WordPress updated successfully.
This output is coming from the new WP code to automatically update translations when updating core.
It seems that WP_CLI\UpgraderSkin is not being used in this context because the static method Language_Pack_Upgrader::async_upgrade() instantiate Language_Pack_Upgrader class with a hard coded skin. I guess we will have to open a new ticket on core. I decided to open an issue here first in case anyone has another idea on how to fix this.
I guess we will have to open a new ticket on core.
Please link the ticket here when you open it.
https://core.trac.wordpress.org/ticket/30497
@rodrigoprimo Can you provide a reproducible test case for this? I'm not sure whether it's still a bug, as I can't reproduce locally.
@danielbachhuber I'm not able to reproduce this anymore so I guess it was fixed somehow. Closing the issue. Thanks.
@rodrigoprimo 👍 thanks
I got similar output when I upgraded from 4.5.3 to 4.6. I ignored it thinking some language update issue. Hindi language was activated in my system. May be it appears in update in language other than default English.
@ernilambar I was testing with Brazilian Portuguese activated on my WP. Are you able to reproduce this issue again? Maybe it is necessary to make sure translation files are outdated and that is what I missed last time I tried to reproduce it?
Steps to reproduce.
- Install WP 4.5.3
- Install and activate
hi_INlanguage - Update to 4.6.
- After update:
Updating to version 4.6 (hi_IN)...
https://downloads.wordpress.org/release/hi_IN/wordpress-4.6.zip से अपडेट डाउनलोड कर रहे हैं...
अपडेट अनपैकिंग...
<p>अपने अनुवाद कुछ अपडेट की जरूरत है। हम के रूप में अच्छी तरह से उन्हें अद्यतन , जबकि कुछ और सेकंड के लिए तंग बैठो।</p>
<div class="update-messages lp-show-latest"><h2>Date Today Nepali (hi_IN)… के लिए अनुवाद का अद्यतन किया जा रहा है।</h2><p><span class="code">https://downloads.wordpress.org/translation/plugin/date-today-nepali/2.2/hi_IN.zip</span>… से अनुवाद डाउनलोड किया जा रहा</p>
<p>अपडेट अनपैकिंग…</p>
<p>नवीनतम संस्करण स्थापित(इन्सटॉल) कर रहे हैं…</p>
<p>अनुवाद सफलतापूर्वक अपडेट किया गया.</p>
</div><script type="text/javascript">
(function( wp ) {
if ( wp && wp.updates.decrementCount ) {
wp.updates.decrementCount( "translation" );
}
})( window.wp );
</script>Cleaning up files...
No files found that need cleaned up.
Success: WordPress updated successfully.
@ernilambar thanks for taking the time to test this. I wasn't able to reproduce the same behavior. Which version of WP-CLI are you running? I just tested with the latest version from the master branch. Here is what I did:
$ wp core download --version=4.5.3
Downloading WordPress 4.5.3 (en_US)...
Using cached file '~/.wp-cli/cache/core/wordpress-4.5.3-en_US.tar.gz'...
Success: WordPress downloaded.
$ wp core config --prompt
Success: Generated 'wp-config.php' file.
$ wp core install --prompt
Success: WordPress installed successfully.
$ wp core language install hi_IN
Success: Language installed.
$ wp core language activate hi_IN
Success: Language activated.
$ wp core update
Updating to version 4.6 (hi_IN)...
https://downloads.wordpress.org/release/hi_IN/wordpress-4.6.zip से अपडेट डाउनलोड कर रहे हैं...
अपडेट अनपैकिंग...
Cleaning up files...
No files found that need cleaned up.
Success: WordPress updated successfully.
Are you running the same commands and getting the HTML output?
Ahh, I had tested in existing WordPress setup. But now I checked again and there is no such output. I am not sure what happening actually :grin:
@ernilambar maybe there was an language update available when you first tested? Do you happen to know how to downgrade a language package so that we can test what happens when we run the commands above with an outdated language package? Thanks for your help!
@rodrigoprimo @ernilambar Is this a core bug, or a WP-CLI bug?
It used to be a core bug but I'm not sure anymore since now I can't reproduce it :smile:
I saw such output once. I tried but could not specifically reproduce it again.
Ok. If someone can reproduce this with specific steps and identify where the bug is with WP-CLI, then we can get it fixed.
I am able to reproduce this still with 5.1.0 -> 5.1.1 upgrade. See https://core.trac.wordpress.org/ticket/30497#comment:4
Just happened to me today with wp core update --version=nightly.
A workaround could be to disable async translation updates using add_filter( 'async_update_translation', '__return_false' ); and instead encourage users to use wp language core update and the like for updates.
A workaround could be to disable async translation updates
Fwiw: This is already the case for plugins/themes: https://github.com/wp-cli/extension-command/blob/fba4b2c/src/WP_CLI/CommandWithUpgrade.php#L20-L23
Yes, the behavior for core should be updated to match the one we currently have for plugins/themes.
It happened to me today. I think it only happens when you do an upgrade and you have translations pending to be updated, which is too often in Spanish. So disabling the async translations could fix the issue.
Following error occurred when the task was run via CRON - I'm not sure whether this is the same issue or not.
Warning: Declaration of WP_CLI\UpgraderSkin::feedback($string) should be compatible with WP_Upgrader_Skin::feedback($string, ...$args) in phar:///home/PROJECT/bin/wp/php/WP_CLI/UpgraderSkin.php on line 59
name old_version new_version status
redirection 4.4.2 4.5.1 Updated
@markhowellsmead Witch WP-CLI and WordPress version are you using?
@markhowellsmead You have to update WP-CLI to 2.4.0, see https://github.com/wp-cli/wp-cli/pull/5283.
I'm still wrapping my head around a fix, but before my focus time on open-source is up, I wanted to share a more reliable reproduction using the --locale flag within the wp core download command:
wp core download --locale=fr_CA --version='4.8'
wp config create --dbname='local' --dbuser='root' --dbpass='root' --dbhost='localhost' --skip-check
wp core update

I'm still wrapping my head around a fix
The fix was mentioned in the discussion above already.
We need to add something like the following to Core_Command::update().
// Do not automatically check translations updates after updating plugins/themes.
add_action( 'upgrader_process_complete', function() {
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
}, 1 );