Skip to content

add $hook_extra to LanguagePackUpgrader::download_package. - #100

Merged
schlessera merged 4 commits into
wp-cli:masterfrom
torounit:fix/LanguagePackUpgrader
Aug 26, 2020
Merged

schlessera merged 4 commits into
wp-cli:masterfrom
torounit:fix/LanguagePackUpgrader

Conversation

@torounit

Copy link
Copy Markdown
Contributor

Fix PHP Warning with WP 5.5.

In WordPress 5.5, the argument $hook_extra has been added to WP_Upgrader::download_package.

PHP Warning:  Declaration of WP_CLI\LanguagePackUpgrader::download_package($package, $check_signatures = false) should be compatible with WP_Upgrader::download_package($package, $check_signatures = false, $hook_extra = Array) in phar:///usr/local/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/LanguagePackUpgrader.php on line 51

@torounit
torounit requested a review from a team as a code owner August 18, 2020 07:00
Comment thread src/WP_CLI/LanguagePackUpgrader.php Outdated
use short array syntax .

Co-authored-by: Wojciech Smoliński <wojsmol@wp.pl>
@schlessera

Copy link
Copy Markdown
Member

@torounit You not only need to add $hook_extra to the method signature, you also need to pass it on to the 'upgrader_pre_download' filter within that method, so that it can serve its purpose.

@torounit

Copy link
Copy Markdown
Contributor Author

@schlessera Thank you your reviewing !!
fixed filter parameter now.

@schlessera schlessera added this to the 2.0.7 milestone Aug 26, 2020
@schlessera schlessera added the command:language-core-update Related to 'language core update' command label Aug 26, 2020
@schlessera
schlessera merged commit aea62e7 into wp-cli:master Aug 26, 2020
@schlessera

Copy link
Copy Markdown
Member

Thanks for the PR, @torounit !

@nderambure

Copy link
Copy Markdown

Hello, I still have this issue with WP-Cli 2.4.0.
I'm on MacOS Big Sur 11.1, PHP 7.4 (installed via homebrew).
I get this warning when updating languages :

PHP Warning: Declaration of WP_CLI\LanguagePackUpgrader::download_package($package, $check_signatures = false) should be compatible with WP_Upgrader::download_package($package, $check_signatures = false, $hook_extra = Array) in phar:///usr/local/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/LanguagePackUpgrader.php on line 51

But everything updates smoothly, just a warning.

@wojsmol

wojsmol commented Jan 27, 2021

Copy link
Copy Markdown
Contributor

@nderambure Please see wp-cli/wp-cli#5494 (comment)

@nderambure

Copy link
Copy Markdown

Thx @wojsmol, missed that one !

@strarsis

Copy link
Copy Markdown

@torounit: In WP CLI nightly (2,5,x) the issue is indeed fixed (probably by this PR, right?). What still bothers me is the reason for why this issue occurred on some sites but no on other sites. The sites run on the same server and have the same WordPress core releases, the same languages should be installed and used, and the same WP CLI is used on workstation/client and server (2.4). So why does this warning/notice happens for one particular site, but not for other sites? Also it seems to happen when using a blank site and transferring the database over to it from the affected site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:language-core-update Related to 'language core update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants