Merge pull request #8859 from annando/fix-callstack
Fix unneeded database functions in the callstack
This commit is contained in:
commit
ca6c95f92d
1 changed files with 5 additions and 3 deletions
|
@ -45,20 +45,22 @@ class System
|
||||||
array_shift($trace);
|
array_shift($trace);
|
||||||
|
|
||||||
$callstack = [];
|
$callstack = [];
|
||||||
$previous = ['class' => '', 'function' => ''];
|
$previous = ['class' => '', 'function' => '', 'database' => false];
|
||||||
|
|
||||||
// The ignore list contains all functions that are only wrapper functions
|
// The ignore list contains all functions that are only wrapper functions
|
||||||
$ignore = ['fetchUrl', 'call_user_func_array'];
|
$ignore = ['fetchUrl', 'call_user_func_array'];
|
||||||
|
|
||||||
while ($func = array_pop($trace)) {
|
while ($func = array_pop($trace)) {
|
||||||
if (!empty($func['class'])) {
|
if (!empty($func['class'])) {
|
||||||
// Don't show multiple calls from the "dba" class to show the essential parts of the callstack
|
// Don't show multiple calls from the Database classes to show the essential parts of the callstack
|
||||||
if ((($previous['class'] != $func['class']) || ($func['class'] != 'Friendica\Database\DBA')) && ($previous['function'] != 'q')) {
|
$func['database'] = in_array($func['class'], ['Friendica\Database\DBA', 'Friendica\Database\Database']);
|
||||||
|
if (!$previous['database'] || !$func['database']) {
|
||||||
$classparts = explode("\\", $func['class']);
|
$classparts = explode("\\", $func['class']);
|
||||||
$callstack[] = array_pop($classparts).'::'.$func['function'];
|
$callstack[] = array_pop($classparts).'::'.$func['function'];
|
||||||
$previous = $func;
|
$previous = $func;
|
||||||
}
|
}
|
||||||
} elseif (!in_array($func['function'], $ignore)) {
|
} elseif (!in_array($func['function'], $ignore)) {
|
||||||
|
$func['database'] = ($func['function'] == 'q');
|
||||||
$callstack[] = $func['function'];
|
$callstack[] = $func['function'];
|
||||||
$func['class'] = '';
|
$func['class'] = '';
|
||||||
$previous = $func;
|
$previous = $func;
|
||||||
|
|
Loading…
Reference in a new issue