X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FCore%2FSystem.php;h=1db417eb88c4ac20dfcb34bea8563e2bc4b458a9;hb=493314a0677d852d2f8ce46888f4e9283494c1be;hp=45e4f652af55d3eb71b61d1cc7ebde0b1f7d8840;hpb=1f38deb77b15261c7ea5111323181c16917d1baa;p=friendica.git diff --git a/src/Core/System.php b/src/Core/System.php index 45e4f652af..1db417eb88 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -4,7 +4,8 @@ */ namespace Friendica\Core; -use Friendica\App; +use Friendica\BaseObject; +use Friendica\Util\XML; /** * @file include/Core/System.php @@ -16,23 +17,8 @@ use Friendica\App; /** * @brief System methods */ -class System +class System extends BaseObject { - private static $a; - - /** - * @brief Initializes the static class variable - * @return void - */ - private static function init() - { - global $a; - - if (!is_object(self::$a)) { - self::$a = $a; - } - } - /** * @brief Retrieves the Friendica instance base URL * @@ -41,8 +27,7 @@ class System */ public static function baseUrl($ssl = false) { - self::init(); - return self::$a->get_baseurl($ssl); + return self::getApp()->get_baseurl($ssl); } /** @@ -54,8 +39,7 @@ class System */ public static function removedBaseUrl($orig_url) { - self::init(); - return self::$a->remove_baseurl($orig_url); + return self::getApp()->remove_baseurl($orig_url); } /** @@ -71,17 +55,17 @@ class System array_shift($trace); array_shift($trace); - $callstack = array(); + $callstack = []; $counter = 0; - $previous = array('class' => '', 'function' => ''); + $previous = ['class' => '', 'function' => '']; // The ignore list contains all functions that are only wrapper functions - $ignore = array('get_config', 'get_pconfig', 'set_config', 'set_pconfig', 'fetch_url', 'probe_url'); + $ignore = ['fetchUrl', 'call_user_func_array']; while ($func = array_pop($trace)) { if (!empty($func['class'])) { - // Don't show multiple calls from the same function (mostly used for "dba" class) - if (($previous['class'] != $func['class']) && ($previous['function'] != 'q')) { + // Don't show multiple calls from the "dba" class to show the essential parts of the callstack + if ((($previous['class'] != $func['class']) || ($func['class'] != 'dba')) && ($previous['function'] != 'q')) { $classparts = explode("\\", $func['class']); $callstack[] = array_pop($classparts).'::'.$func['function']; $previous = $func; @@ -92,7 +76,7 @@ class System } } - $callstack2 = array(); + $callstack2 = []; while ((count($callstack2) < $depth) && (count($callstack) > 0)) { $callstack2[] = array_pop($callstack); } @@ -100,6 +84,100 @@ class System return implode(', ', $callstack2); } + /** + * @brief Called from db initialisation when db is dead. + */ + static public function unavailable() { +echo <<< EOT + +