X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fstatusnet.php;h=33bf32b10e2a59f962cb06a72312f49054ff4a66;hb=ac4afb31e81c16f320b764c723195f55782f4b95;hp=ef3adebf94fdf4bbc9223bc6a2d9435bf79e6411;hpb=8bf1b54abd860fbfa8c036aac0c3d3a5faf2f489;p=quix0rs-gnu-social.git diff --git a/lib/statusnet.php b/lib/statusnet.php index ef3adebf94..33bf32b10e 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -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'"); @@ -155,7 +169,6 @@ class StatusNet return $sites; } - /** * Fire initialization events for all instantiated plugins. */ @@ -206,7 +219,7 @@ class StatusNet { return self::$is_api; } - + public function setApi($mode) { self::$is_api = $mode; @@ -232,6 +245,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 +335,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; + } } } @@ -342,11 +359,7 @@ class StatusNet if (array_key_exists('memcached', $config)) { if ($config['memcached']['enabled']) { - if(class_exists('Memcached')) { - addPlugin('Memcached', array('servers' => $config['memcached']['server'])); - } else { - addPlugin('Memcache', array('servers' => $config['memcached']['server'])); - } + addPlugin('Memcache', array('servers' => $config['memcached']['server'])); } if (!empty($config['memcached']['base'])) { @@ -354,6 +367,18 @@ class StatusNet } } } + + /** + * Are we running from the web with HTTPS? + * + * @return boolean true if we're running with HTTPS; else false + */ + + static function isHTTPS() + { + // There are some exceptions to this; add them here! + return !empty($_SERVER['HTTPS']); + } } class NoConfigException extends Exception