Can not run wp plugin uninstall from Perl module
I am not certain that my issue is a result of a bug. So I did post in the WP support forums. In case this is a bug I am posting a link to my support forum question here:
https://wordpress.org/support/topic/can-not-run-wp-plugin-uninstall-from-perl-module/#new-topic-0
@twoelevenjay I had a look at the code to see whether I might spot something that is obviously problematic for your use case.
The Deactivating '<plugin>'... message is still coming from the uninstall() method. It then hands over control to the deactivate() method. This method should then show a Plugin '<plugin>' deactivated. message. The fact that this doesn't show means the deactivation doesn't complete properly.
My current suspicion is that the Perl environment in which the command runs does not contain a required environment setting for one of your plugins, and it triggers the fatal error protection that was added to WordPress.
When the plugin is meant to be deactivated then, the following piece of code within the WordPress deactivate_plugins() method will be triggered:
// Clean up the database before deactivating the plugin.
if ( is_plugin_paused( $plugin ) ) {
resume_plugin( $plugin );
}
This creates a redirect and will probably kill the process for Perl.
What you can try to further diagnose this:
- Try using an older version of WordPress Core before WP 5.2 to see whether the behavior is different. This would mean the Fatal Error Protection is a likely culprit here.
- Try the Perl script on a completely fresh site with a very basic plugin. Maybe the issue comes from something weird one of the installed plugins or themes does.
- Try adding the
--skip-plugins --skip-themesflags to see whether that might resolve the issue. This would also point to a plugin or theme interfering.
Thank you @schlessera, very much for looking into the code. Great suggestions. I will run these tests and report my findings back.
@schlessera, I tired all of these, the behavior remains the same. The deactivation process does happen. If the plugin is active and I run uninstall from Perl, it does deactivate the plugin, but does not uninstall it.
Feel free to stop by the #cli channel on WordPress.org Slack if you'd like help debugging further.