And some more static warnings removed

This commit is contained in:
Michael 2017-08-26 10:01:50 +00:00
commit a729519de9
8 changed files with 43 additions and 40 deletions

View file

@ -2,6 +2,7 @@
namespace Friendica;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
@ -683,7 +684,7 @@ class App {
$this->performance[$value] += (float) $duration;
$this->performance['marktime'] += (float) $duration;
$callstack = $this->callstack();
$callstack = System::callstack();
if (!isset($this->callstack[$value][$callstack])) {
// Prevent ugly E_NOTICE
@ -736,30 +737,6 @@ class App {
q('DELETE FROM `process` WHERE `pid` = %d', intval(getmypid()));
}
/**
* @brief Returns a string with a callstack. Can be used for logging.
*
* @return string
*/
function callstack($depth = 4) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $depth + 2);
// We remove the first two items from the list since they contain data that we don't need.
array_shift($trace);
array_shift($trace);
$callstack = array();
foreach ($trace AS $func) {
if (!empty($func['class'])) {
$callstack[] = $func['class'].'::'.$func['function'];
} else {
$callstack[] = $func['function'];
}
}
return implode(', ', $callstack);
}
function get_useragent() {
return
FRIENDICA_PLATFORM . " '" .

View file

@ -46,11 +46,35 @@ class System {
*
* @return string The cleaned url
*/
function removedBaseUrl($orig_url) {
public static function removedBaseUrl($orig_url) {
self::init();
return self::$a->remove_baseurl($orig_url);
}
/**
* @brief Returns a string with a callstack. Can be used for logging.
*
* @return string
*/
public static function callstack($depth = 4) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $depth + 2);
// We remove the first two items from the list since they contain data that we don't need.
array_shift($trace);
array_shift($trace);
$callstack = array();
foreach ($trace AS $func) {
if (!empty($func['class'])) {
$callstack[] = $func['class'].'::'.$func['function'];
} else {
$callstack[] = $func['function'];
}
}
return implode(', ', $callstack);
}
/// @todo Move the following functions from boot.php
/*
function get_guid($size = 16, $prefix = "")