core-command icon indicating copy to clipboard operation
core-command copied to clipboard

Unexpected HTML output when updating WordPress

Open rodrigoprimo opened this issue 10 years ago • 25 comments

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)&#8230;</h4><p>Fazendo download da tradução de <span class="code">(http://downloads.wordpress.org/translation/core/4.0/pt_BR.zip)</span>&#8230;</p>
<p>Descompactando a atualização&#8230;</p>
<p>Instalando a versão mais recente&#8230;</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.

rodrigoprimo avatar Nov 17 '14 16:11 rodrigoprimo

I guess we will have to open a new ticket on core.

Please link the ticket here when you open it.

danielbachhuber avatar Nov 18 '14 00:11 danielbachhuber

https://core.trac.wordpress.org/ticket/30497

rodrigoprimo avatar Nov 25 '14 12:11 rodrigoprimo

@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 avatar Aug 17 '16 13:08 danielbachhuber

@danielbachhuber I'm not able to reproduce this anymore so I guess it was fixed somehow. Closing the issue. Thanks.

rodrigoprimo avatar Aug 17 '16 20:08 rodrigoprimo

@rodrigoprimo 👍 thanks

danielbachhuber avatar Aug 17 '16 20:08 danielbachhuber

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 avatar Aug 18 '16 11:08 ernilambar

@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?

rodrigoprimo avatar Aug 18 '16 16:08 rodrigoprimo

Steps to reproduce.

  • Install WP 4.5.3
  • Install and activate hi_IN language
  • 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)&#8230; के लिए अनुवाद का अद्यतन किया जा रहा है।</h2><p><span class="code">https://downloads.wordpress.org/translation/plugin/date-today-nepali/2.2/hi_IN.zip</span>&#8230; से अनुवाद डाउनलोड किया जा रहा</p>
<p>अपडेट अनपैकिंग&#8230;</p>
<p>नवीनतम संस्करण स्थापित(इन्सटॉल) कर रहे हैं&#8230;</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 avatar Aug 19 '16 02:08 ernilambar

@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?

rodrigoprimo avatar Aug 19 '16 12:08 rodrigoprimo

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 avatar Aug 21 '16 05:08 ernilambar

@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 avatar Aug 22 '16 15:08 rodrigoprimo

@rodrigoprimo @ernilambar Is this a core bug, or a WP-CLI bug?

danielbachhuber avatar Sep 01 '16 13:09 danielbachhuber

It used to be a core bug but I'm not sure anymore since now I can't reproduce it :smile:

rodrigoprimo avatar Sep 01 '16 14:09 rodrigoprimo

I saw such output once. I tried but could not specifically reproduce it again.

ernilambar avatar Sep 01 '16 14:09 ernilambar

Ok. If someone can reproduce this with specific steps and identify where the bug is with WP-CLI, then we can get it fixed.

danielbachhuber avatar Sep 01 '16 20:09 danielbachhuber

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

ottok avatar Mar 23 '19 11:03 ottok

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.

swissspidy avatar Mar 28 '19 12:03 swissspidy

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

ocean90 avatar Mar 28 '19 17:03 ocean90

Yes, the behavior for core should be updated to match the one we currently have for plugins/themes.

schlessera avatar Mar 29 '19 11:03 schlessera

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.

planetahuevo avatar Sep 05 '19 12:09 planetahuevo

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 avatar Nov 24 '19 10:11 markhowellsmead

@markhowellsmead Witch WP-CLI and WordPress version are you using?

wojsmol avatar Nov 24 '19 11:11 wojsmol

@markhowellsmead You have to update WP-CLI to 2.4.0, see https://github.com/wp-cli/wp-cli/pull/5283.

ocean90 avatar Nov 24 '19 15:11 ocean90

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

Image 2021-09-17 at 10 35 29 AM

bgturner avatar Sep 17 '21 17:09 bgturner

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 );

swissspidy avatar Sep 20 '21 14:09 swissspidy