S3-Uploads
S3-Uploads copied to clipboard
Non-composer install can't successful,wp-cli have result an error
When I install from releases->3.0.4->manual-install.zip
I upload files to /wp-content/plugins/s3-uploads
,all looks fine,but when I used wp-cli command to activate it,It's Error:
wp plugin activate s3-uploads --path="/www/wwwroot/wp"
Error: Callable "S3_Uploads\\WP_CLI_Command" does not exist, and cannot be registered as `wp s3-uploads`.
And I can't used command wp plugin status --path="/www/wwwroot/wp"
beacuse wp-cli will result same error:
Error: Callable "S3_Uploads\\WP_CLI_Command" does not exist, and cannot be registered as `wp s3-uploads`.
I see a same error log in issues#528,he say the error in 3.0.1, but I tested this error no fix in releases 3.0.2-3.0.4?Really???
I solved adding the s3-uploads/inc/class-wp-cli-command.php
to require
directive on wp-cli.yml
file.
require:
- wp-content/plugins/s3-uploads/inc/class-wp-cli-command.php
I solved adding the
s3-uploads/inc/class-wp-cli-command.php
torequire
directive onwp-cli.yml
file.require: - wp-content/plugins/s3-uploads/inc/class-wp-cli-command.php
for people wondering: add in you project home (document root) wp-cli.yml file
Hi there! This happens because the class is loaded too late. The require here will call during the init
hook, while the add_command
is executed before that, here.
That could be solved by moving the add_command
call to somewhere inside the init()
function (as namespace.php is inside a namespace, the WP_CLI calls will need to become \WP_CLI.)
Tagging @kovshenin for visibility on this duplicate issue as well as he seems to be the only one looking at issues recently.