wp-cli / core-command

Downloads, installs, updates, and manages a WordPress installation.
MIT License
49 stars 50 forks source link

Unexpected HTML output when updating WordPress #191

Open rodrigoprimo opened 10 years ago

rodrigoprimo commented 10 years ago

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.

danielbachhuber commented 10 years ago

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

Please link the ticket here when you open it.

rodrigoprimo commented 9 years ago

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

danielbachhuber commented 8 years ago

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

rodrigoprimo commented 8 years ago

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

danielbachhuber commented 8 years ago

@rodrigoprimo 👍 thanks

ernilambar commented 8 years ago

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.

rodrigoprimo commented 8 years ago

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

ernilambar commented 8 years ago

Steps to reproduce.

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.
rodrigoprimo commented 8 years ago

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

ernilambar commented 8 years ago

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:

rodrigoprimo commented 8 years ago

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

danielbachhuber commented 8 years ago

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

rodrigoprimo commented 8 years ago

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

ernilambar commented 8 years ago

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

danielbachhuber commented 8 years ago

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

ottok commented 5 years ago

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

swissspidy commented 5 years ago

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.

ocean90 commented 5 years ago

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

schlessera commented 5 years ago

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

planetahuevo commented 5 years ago

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.

markhowellsmead commented 4 years ago

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
wojsmol commented 4 years ago

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

ocean90 commented 4 years ago

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

bgturner commented 3 years ago

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

swissspidy commented 3 years ago

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