-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
This would be prevented if all this functionality would be bundled with the plugin.
But I have installed the cli indepentendly and on not every site in my multisite has the plugin running.
So when clearing all caches after each deploy via a bash script I get this error:
Error: The plugin WP-Rocket seems not enabled on this site.
Fatal error: Uncaught Error: Call to undefined function run_rocket_bot() in /home/reistst/domains/reistst.ssdwp.nl/deployments/releases/20220523093123/vendor/wp-media/wp-rocket-cli/command.php:321
Stack trace:
#0 [internal function]: WPRocket_CLI->preload()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(417): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(440): WP_CLI\Runner->run_command()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/l in /home/reistst/domains/xyz.bla.nl/deployments/releases/123/vendor/wp-media/wp-rocket-cli/command.php on line 321
P.s. my solution for now for other developer can be this bash lines:
# WP Rocket: Only run WP Rocket cache clearing if WP Rocket is activated!
wp plugin is-active wp-rocket --url=$url
# Check if plugin is activate, sets exit status to 1 if not active and 0 if IS active
if [ $? -eq 0 ]; then
# WP Rocket clear and preload
wp rocket clean --confirm --url=$url
wp rocket preload --sitemap --url=$url
fi
Metadata
Metadata
Assignees
Labels
No labels