]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
StatusNet::delPlugin($name) added to disable plugins
authorMikael Nordfeldth <mmn@hethane.se>
Fri, 30 May 2014 22:27:23 +0000 (00:27 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Fri, 30 May 2014 22:27:23 +0000 (00:27 +0200)
Instead of setting some weird $config['plugins']['disable-Blah'] yourself.
The class name, StatusNet, will probably change in the future to GNU social.
No global function added, as it exists for addPlugin().

lib/statusnet.php

index 5c2c3d5fdc58553891ccba03374bbf7d6869a0e2..a9b05388c393f6e0e6a4a51c55c96407a2a08845 100644 (file)
@@ -91,6 +91,20 @@ class StatusNet
         return true;
     }
 
+    public static function delPlugin($name)
+    {
+        // Remove our plugin if it was previously loaded
+        $name = ucfirst($name);
+        if (isset(self::$plugins[$name])) {
+            unset(self::$plugins[$name]);
+        }
+
+        // make sure initPlugins will avoid this
+        common_config_set('plugins', 'disable-'.$name, true);
+
+        return true;
+    }
+
     /**
      * Get a list of activated plugins in this process.
      * @return array of (string $name, array $args) pairs