Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if plugin is active on installation #54

Open
jmslbam opened this issue May 23, 2022 · 0 comments
Open

Check if plugin is active on installation #54

jmslbam opened this issue May 23, 2022 · 0 comments

Comments

@jmslbam
Copy link

jmslbam commented May 23, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant