ideasonpurpose / basic-wordpress-vagrant

A fast, easy to use WordPress Vagrant environment modeled after managed WordPress hosting platforms like WP Engine and Flywheel.
MIT License
25 stars 3 forks source link

Skip missing plugin install on PHP fatal error #44

Closed joemaller closed 7 years ago

joemaller commented 7 years ago

Just happened due to some problem with Advanced Custom Fields.

joemaller commented 7 years ago

Example error when running wp plugin list --status=active --format=json --path=/vagrant/site --debug

Debug (bootstrap): Using default global config: /home/vagrant/.wp-cli/config.yml (0.008s)
Debug (bootstrap): No project config found (0.008s)
Debug (bootstrap): No package autoload found to load. (0.154s)
Debug (bootstrap): ABSPATH defined: /vagrant/site/ (0.154s)
Debug (bootstrap): Begin WordPress load (0.156s)
Debug (bootstrap): wp-config.php path: /vagrant/site/wp-config.php (0.157s)
Debug (bootstrap): Loaded WordPress (1.889s)
Debug (bootstrap): Running command: plugin list (1.889s)
PHP Fatal error:  Uncaught Error: Call to undefined function acf_add_admin_notice() in /vagrant/site/wp-content/plugins/advanced-custom-fields-pro/pro/api/api-pro.php:330
Stack trace:
  #0 /vagrant/site/wp-content/plugins/advanced-custom-fields-pro/pro/core/updates.php(165): acf_pro_is_license_active()
  #1 /vagrant/site/wp-includes/class-wp-hook.php(298): acf_pro_updates->plugin_update(Object(stdClass), Object(stdClass))
  #2 /vagrant/site/wp-includes/plugin.php(203): WP_Hook->apply_filters(Object(stdClass), Array)
  #3 /vagrant/site/wp-content/plugins/advanced-custom-fields-pro/core/updates.php(122): apply_filters('acf/updates/plu...', Object(stdClass), Object(stdClass))
  #4 /vagrant/site/wp-includes/class-wp-hook.php(300): acf_updates->modify_plugin_update(Object(stdClass))
  #5 /vagrant/site/wp-includes/plugin.php(203): WP_Hook->apply_filters(Object(stdClass), Array)
  #6 /vagrant/site/wp-includes/option.php(1653): apply_filters('pre_set_site_tr...', Object(stdClass), 'update_plugins')
  #7 /vagrant/site/wp-includes/update.php(268): set_ in /vagrant/site/wp-content/plugins/advanced-custom-fields-pro/pro/api/api-pro.php on line 330", 
joemaller commented 7 years ago

Seems to have been a bug in ACF 5.5.0. Manually swapping the plugin for 5.5.1 removed the error. But I was able to workaround the error, so it's fixed for next time too.