processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

Modules, fresh installation of a new module doesn't detect duplicates #1657

Closed solonmedia closed 1 year ago

solonmedia commented 1 year ago

Short description of the issue

When two modules with the same class name exist in the site/modules/ directory and neither have been installed, a single copy appears in the modules cache, and trying to install it results in an error because of a clash in class names.

Expected behavior

The system should pick the first version it finds and install it. The version selection can be made once the first found copy installs.

Actual behavior

The system appears to try to install both versions, and fails when trying to process the second class definition without writing the module configuration row to the database. As a result, the module cannot be configured and a version cannot be selected.

Steps to reproduce the issue

  1. Copy any site/module in the sites directory that has not been installed to a new directory in site/modules.
  2. Refresh the modules cache and then try to install the single copy that appears.

Setup/Environment

This doesn't happen when creating customized version of wire/modules in site/modules because the core modules being modified likely already are installed.

matjazpotocnik commented 1 year ago

@ryancramerdesign this is still an issue. You get an error when you try to install a module with the same class name, as solonmedia described. If you then delete a folder with a duplicate module, you can't uninstall it:

image

I had to restore the folder with the duplicate module, and then I could uninstall it. After uninstall, I again deleted the folder with the duplicate module (the “original” module is in folder /site/modules/AddLink and the copy of the module with the same class is in folder /site/modules/AddLink - Kopija) and attempted to install the module, but I couldn't:

image

It looks like the modules cache is still referencing the copy of the nonexisting module directory. Modules Refresh fixed it.

ryancramerdesign commented 1 year ago

@solonmedia @matjazpotocnik Thanks, I've pushed a fix for this.

matjazpotocnik commented 1 year ago

Thanks Ryan, looks good. @solonmedia, closing.