extension-command icon indicating copy to clipboard operation
extension-command copied to clipboard

Can not run wp plugin uninstall from Perl module

Open twoelevenjay opened this issue 6 years ago • 3 comments

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 avatar Aug 04 '19 09:08 twoelevenjay

@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:

  1. 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.
  2. 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.
  3. Try adding the --skip-plugins --skip-themes flags to see whether that might resolve the issue. This would also point to a plugin or theme interfering.

schlessera avatar Aug 06 '19 11:08 schlessera

Thank you @schlessera, very much for looking into the code. Great suggestions. I will run these tests and report my findings back.

twoelevenjay avatar Aug 06 '19 18:08 twoelevenjay

@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.

twoelevenjay avatar Aug 07 '19 07:08 twoelevenjay

Feel free to stop by the #cli channel on WordPress.org Slack if you'd like help debugging further.

danielbachhuber avatar Nov 10 '23 23:11 danielbachhuber