]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/statusnet.php
Followup to IIS installer tweaks in [9bb48c36]:
[quix0rs-gnu-social.git] / lib / statusnet.php
index 7c4df84b4a7692ed59c5b770d5a044dbcdcfcc55..7cb831696bc02ac512a69f6190469242227371c4 100644 (file)
@@ -31,6 +31,7 @@ class StatusNet
 {
     protected static $have_config;
     protected static $is_api;
+    protected static $plugins = array();
 
     /**
      * Configure and instantiate a plugin into the current configuration.
@@ -74,9 +75,22 @@ class StatusNet
                 $inst->$aname = $avalue;
             }
         }
+
+        // Record activated plugins for later display/config dump
+        self::$plugins[] = array($name, $attrs);
+
         return true;
     }
 
+    /**
+     * Get a list of activated plugins in this process.
+     * @return array of (string $name, array $args) pairs
+     */
+    public static function getActivePlugins()
+    {
+        return self::$plugins;
+    }
+
     /**
      * Initialize, or re-initialize, StatusNet global configuration
      * and plugins.
@@ -127,7 +141,7 @@ class StatusNet
             return true;
         }
 
-        $sn = Status_network::staticGet($nickname);
+        $sn = Status_network::staticGet('nickname', $nickname);
         if (empty($sn)) {
             return false;
             throw new Exception("No such site nickname '$nickname'");
@@ -232,6 +246,7 @@ class StatusNet
         global $_server, $_path, $config;
 
         Event::clearHandlers();
+        self::$plugins = array();
 
         // try to figure out where we are. $server and $path
         // can be set by including module, else we guess based
@@ -321,8 +336,11 @@ class StatusNet
 
         foreach ($config_files as $_config_file) {
             if (@file_exists($_config_file)) {
-                include($_config_file);
-                self::$have_config = true;
+                // Ignore 0-byte config files
+                if (filesize($_config_file) > 0) {
+                    include($_config_file);
+                    self::$have_config = true;
+                }
             }
         }
 
@@ -354,10 +372,10 @@ class StatusNet
 
 class NoConfigException extends Exception
 {
-    public $config_files;
+    public $configFiles;
 
-    function __construct($msg, $config_files) {
+    function __construct($msg, $configFiles) {
         parent::__construct($msg);
-        $this->config_files = $config_files;
+        $this->configFiles = $configFiles;
     }
 }