View Issue Details

IDProjectCategoryView StatusLast Update
0017798phplist applicationpluginspublic02-10-15 19:25
Reporterduncanc 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.2.0 
Target Versionnext minorFixed in Version3.2.1 
Summary0017798: Plugin remains enabled after dependency is not met
DescriptionThis is a bit of an edge case when installing and enabling plugins.

A plugin has dependencies that are met and so is enabled. If later a dependency becomes not met then the plugin seems to remain enabled.
If you view the plugins page then the plugin is shown as having unmet dependencies but it is still actually enabled.

Depending on what the dependency actually is that might be a problem. I found this when disabling CommonPlugin and found that other plugins that had it as a dependency remained enabled and failed due to the CommonPlugin class not existing.

One solution is to verify the dependencies when loading each plugin.
See file admin/pluginlib.php. Add a test of the dependencies to this line

if (!in_array($className,$GLOBALS['plugins_disabled']) ) {

if (!in_array($className,$GLOBALS['plugins_disabled']) && pluginCanEnable($className)) {

This seems to avoid the problem but you might also want to add the plugin to the set of disabled plugins instead of just ignoring it.
TagsNo tags attached.

Activities

duncanc

15-08-15 14:27

developer   ~0056637

I'm not correct in saying that the plugin remains enabled, rather it is "not disabled".

michiel

28-09-15 12:08

manager   ~0056898

hmm, tricky this. Adding this check depends on the order in which plugins are loaded. I added the check and as a result could not enable a plugin that depended on the common plugin, even when the commonplugin was enabled.

So, it would need two passes to work, which is not great for performance.

duncanc

01-10-15 13:41

developer   ~0056928

Yes, I see what you mean now.

Possibly another way is, when a plugin is disabled to also test the dependencies of all other plugins, so that a plugin which depends on the one being disabled is also disabled at the same time.

michiel

01-10-15 13:47

manager   ~0056929

Yes, that's a good plan.

michiel

02-10-15 19:25

manager   ~0056941

https://github.com/phpList/phplist3/pull/30