From cc5aff5de329d9918da1ae40e51641e1702c3ccc Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 31 May 2014 00:27:23 +0200 Subject: [PATCH] StatusNet::delPlugin($name) added to disable plugins 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/statusnet.php b/lib/statusnet.php index 5c2c3d5fdc..a9b05388c3 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -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