easy-digital-downloads icon indicating copy to clipboard operation
easy-digital-downloads copied to clipboard

Should not run uninstall.php if another active installation is found

Open paulgoodchild opened this issue 5 years ago • 3 comments

Summary: I don't entirely trust WP's ability to wholly and correctly remove a plugin and install its upgrade from WordPress.org. Assuming WP itself doesn't fall over itself, anything can interrupt the upgrade process and leave a broken installation, which collapses the site.

So, I manually install the EDD upgrade in a separate folder and switch between the old and the new. If there's a problem, I switch back.

This means there are 2x installation of EDD on the site. One active, the other inactive.

After we're happy with the upgrade, the old version is uninstalled

Uninstalling the old version will call the plugin's uninstall.php script.

Bug Report

Expected behavior

When I click to 'Delete' (i.e. uninstall) the EDD plugin, it should do so successfully and without error, when the plugin is also installed and active in another plugin folder.

Actual behavior

The plugin fails to delete.

A fatal error is produced: PHP Fatal error: Cannot redeclare EDD() (previously declared in /public/wp-content/plugins/easy-digital-downloads/easy-digital-downloads.php:476) in /public/wp-content/plugins/easy-digital-downloads.old/easy-digital-downloads.php on line 476

Steps to reproduce the behavior

  1. Install EDD
  2. Activate EDD
  3. Install EDD again, but in another folder. Do not activate.
  4. Click to delete EDD installed in step (3).
  5. Fatal error encountered.

Information (if a specific version is affected):

EDD Version (or branch): 2.9.19

Any other relevant information:

There should be a check for EDD() and if it's declared (meaning EDD is active in another folder) the uninstall.php process is exited and no further processing done.

This check will also solve for the PHP Fatal error.

paulgoodchild avatar Nov 05 '19 14:11 paulgoodchild

@paulgoodchild Thanks for the report. However, I was not able to replicate this. I am able to have 2 copies installed and activate/deactivate one of them with no fatal errors.

mintplugins avatar Nov 05 '19 16:11 mintplugins

@paulgoodchild Thanks for the report. However, I was not able to replicate this. I am able to have 2 copies installed and activate/deactivate one of them with no fatal errors.

Thanks for getting back. It's not deactivate or activate, it's Delete. Only when you delete a deactivated plugin does it call uninstall.php. Did you test that scenario?

Edit: Just fired up a quick test site to simply test this scenario according to the steps laid out above. Straight forward to reproduce for me on a new WP site. See image attached:

2019-11-05_18-11-08

paulgoodchild avatar Nov 05 '19 18:11 paulgoodchild

I would say this will be easier once 3.0 is out as we have a more dynamic method of knowing if something is active. I'm going to punt to after 3.0 as I think it's a small use case, but something that will be more reliable on 3.0's codebase.

cklosowski avatar Mar 04 '20 20:03 cklosowski