wp-cli / language-command

Installs, activates, and manages language packs.
MIT License
13 stars 21 forks source link

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

Closed torounit closed 4 years ago

torounit commented 4 years ago

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

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

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

schlessera commented 4 years ago

Thanks for the PR, @torounit !

nderambure commented 3 years ago

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 commented 3 years ago

@nderambure Please see https://github.com/wp-cli/wp-cli/issues/5494#issuecomment-767562029

nderambure commented 3 years ago

Thx @wojsmol, missed that one !

strarsis commented 3 years ago

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