wp-media / wp-rocket-cli

WP CLI interface for the WP Rocket plugin
74 stars 37 forks source link

Send a WP-CLI error during a purge command with WP-Rocket plugin missing or deactived #29

Closed herewithme closed 3 years ago

herewithme commented 4 years ago

Instead :

`PHP Fatal error: Uncaught Error: Call to undefined function rocket_clean_domain() in /home/wordpress/.wp-cli/packages/vendor/GeekPress/wp-rocket-cli/command.php:232 Stack trace:

0 [internal function]: WPRocket_CLI->clean(Array, Array)

1 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func(Array, Array, Array)

2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}(Array, Array)

3 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(451): call_user_func(Object(Closure), Array, Array)

4 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(371): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)

5 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(394): WP_CLI\Runner->run_command(Array, Array)

6 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/w in /home/wordpress/.wp-cli/packages/vendor/GeekPress/wp-rocket-cli/command.php on line 232

Fatal error: Uncaught Error: Call to undefined function rocket_clean_domain() in /home/wordpress/.wp-cli/packages/vendor/GeekPress/wp-rocket-cli/command.php:232 Stack trace:

0 [internal function]: WPRocket_CLI->clean(Array, Array)

1 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func(Array, Array, Array)

2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}(Array, Array)

3 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(451): call_user_func(Object(Closure), Array, Array)

4 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(371): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)

5 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(394): WP_CLI\Runner->run_command(Array, Array)

6 phar:///home/wordpress/public_html/tools/wp-cli.phar/vendor/wp-cli/w in /home/wordpress/.wp-cli/packages/vendor/GeekPress/wp-rocket-cli/command.php on line 232`

iCaspar commented 3 years ago

✅ Reproduced. ✅ When plugin is disabled, we can't clear the cache. :) ✅ Solution: Reviewed and tested @herewithme's PR #30 and it's all good. ✅ Contributed PR is good to merge. Many thanks @herewithme!