S3-Uploads icon indicating copy to clipboard operation
S3-Uploads copied to clipboard

Non-composer install can't successful,wp-cli have result an error

Open MIKU-N opened this issue 2 years ago • 4 comments

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

MIKU-N avatar Apr 30 '22 16:04 MIKU-N

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

edpittol avatar May 11 '22 21:05 edpittol

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

for people wondering: add in you project home (document root) wp-cli.yml file

nicovs avatar May 25 '22 16:05 nicovs

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

felipeelia avatar Jun 09 '22 16:06 felipeelia

Tagging @kovshenin for visibility on this duplicate issue as well as he seems to be the only one looking at issues recently.

MattWilliamsDev avatar Nov 29 '22 21:11 MattWilliamsDev