]> git.wh0rd.org Git - tt-rss.git/commitdiff
don't init plugins when loading everything to make a list, duh
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 8 Oct 2015 14:02:32 +0000 (17:02 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 8 Oct 2015 14:02:32 +0000 (17:02 +0300)
classes/pluginhost.php
classes/pref/prefs.php
update.php

index 75620a191e704c77ca911efbb548a5e8a33cc578..0f3d8f37c604abb1f1b2247464a9cf34595672ad 100644 (file)
@@ -133,7 +133,7 @@ class PluginHost {
                        return array();
                }
        }
-       function load_all($kind, $owner_uid = false) {
+       function load_all($kind, $owner_uid = false, $skip_init = false) {
 
                $plugins = array_merge(glob("plugins/*"), glob("plugins.local/*"));
                $plugins = array_filter($plugins, "is_dir");
@@ -141,10 +141,10 @@ class PluginHost {
 
                asort($plugins);
 
-               $this->load(join(",", $plugins), $kind, $owner_uid);
+               $this->load(join(",", $plugins), $kind, $owner_uid, $skip_init);
        }
 
-       function load($classlist, $kind, $owner_uid = false) {
+       function load($classlist, $kind, $owner_uid = false, $skip_init = false) {
                $plugins = explode(",", $classlist);
 
                $this->owner_uid = (int) $owner_uid;
@@ -181,18 +181,18 @@ class PluginHost {
                                        switch ($kind) {
                                        case $this::KIND_SYSTEM:
                                                if ($this->is_system($plugin)) {
-                                                       $plugin->init($this);
+                                                       if (!$skip_init) $plugin->init($this);
                                                        $this->register_plugin($class, $plugin);
                                                }
                                                break;
                                        case $this::KIND_USER:
                                                if (!$this->is_system($plugin)) {
-                                                       $plugin->init($this);
+                                                       if (!$skip_init) $plugin->init($this);
                                                        $this->register_plugin($class, $plugin);
                                                }
                                                break;
                                        case $this::KIND_ALL:
-                                               $plugin->init($this);
+                                               if (!$skip_init) $plugin->init($this);
                                                $this->register_plugin($class, $plugin);
                                                break;
                                        }
index 41dc536f500e1a903853720fee45ed30d40b3ecf..9cbc425c6115d299efb9d8463744816831311e41 100644 (file)
@@ -746,7 +746,7 @@ class Pref_Prefs extends Handler_Protected {
                $user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS")));
 
                $tmppluginhost = new PluginHost();
-               $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"]);
+               $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"], true);
                $tmppluginhost->load_data(true);
 
                foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
index 0fa4db0d8a7bab5511cf9975f401f6d9e1b61ba5..96097c56ad2e3675921f564b86651a954fb9a60e 100755 (executable)
 
        if (isset($options["list-plugins"])) {
                $tmppluginhost = new PluginHost();
-               $tmppluginhost->load_all($tmppluginhost::KIND_ALL);
+               $tmppluginhost->load_all($tmppluginhost::KIND_ALL, false);
                $enabled = array_map("trim", explode(",", PLUGINS));
 
                echo "List of all available plugins:\n";