Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add $hook_extra to LanguagePackUpgrader::download_package. #100

Merged
merged 4 commits into from Aug 26, 2020

Conversation

@torounit
Copy link
Contributor

@torounit torounit commented Aug 18, 2020

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 as a code owner Aug 18, 2020
src/WP_CLI/LanguagePackUpgrader.php Outdated Show resolved Hide resolved
Loading
use short array syntax .

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

@schlessera schlessera commented Aug 26, 2020

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

Loading

@torounit
Copy link
Contributor Author

@torounit torounit commented Aug 26, 2020

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

Loading

@schlessera schlessera added this to the 2.0.7 milestone Aug 26, 2020
@schlessera schlessera merged commit aea62e7 into wp-cli:master Aug 26, 2020
3 checks passed
Loading
@schlessera
Copy link
Member

@schlessera schlessera commented Aug 26, 2020

Thanks for the PR, @torounit !

Loading

@nderambure
Copy link

@nderambure nderambure commented Jan 27, 2021

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.

Loading

@wojsmol
Copy link
Contributor

@wojsmol wojsmol commented Jan 27, 2021

Loading

@nderambure
Copy link

@nderambure nderambure commented Jan 27, 2021

Thx @wojsmol, missed that one !

Loading

@strarsis
Copy link

@strarsis strarsis commented Apr 22, 2021

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants