浏览代码

Don't let dependant plugins automatically enable plugins which should be disabled by default

Follow-up to f10440b and c0a7fdc
Daniel Rudolf 9 年之前
父节点
当前提交
a2aa46fd0e
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      lib/AbstractPicoPlugin.php

+ 7 - 2
lib/AbstractPicoPlugin.php

@@ -78,8 +78,13 @@ abstract class AbstractPicoPlugin implements PicoPluginInterface
                 if (is_array($pluginConfig) && isset($pluginConfig['enabled'])) {
                     $this->setEnabled($pluginConfig['enabled']);
                 } elseif ($this->enabled) {
-                    // make sure dependencies are fulfilled
-                    $this->checkDependencies(true);
+                    // make sure dependencies are already fulfilled,
+                    // otherwise the plugin needs to be enabled manually
+                    try {
+                        $this->checkDependencies(false);
+                    } catch (RuntimeException $e) {
+                        $this->enabled = false;
+                    }
                 }
             }
         }