From: Michael Date: Fri, 10 Jul 2020 07:01:28 +0000 (+0000) Subject: Fix unneeded database functions in the callstack X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fcb37449f397ab2a62d40edbc3b7d1f4d38b4a1f;p=friendica.git Fix unneeded database functions in the callstack --- diff --git a/src/Core/System.php b/src/Core/System.php index 46f0cb4f32..feed85e211 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -45,20 +45,22 @@ class System array_shift($trace); $callstack = []; - $previous = ['class' => '', 'function' => '']; + $previous = ['class' => '', 'function' => '', 'database' => false]; // The ignore list contains all functions that are only wrapper functions $ignore = ['fetchUrl', 'call_user_func_array']; while ($func = array_pop($trace)) { if (!empty($func['class'])) { - // Don't show multiple calls from the "dba" class to show the essential parts of the callstack - if ((($previous['class'] != $func['class']) || ($func['class'] != 'Friendica\Database\DBA')) && ($previous['function'] != 'q')) { + // Don't show multiple calls from the Database classes to show the essential parts of the callstack + $func['database'] = in_array($func['class'], ['Friendica\Database\DBA', 'Friendica\Database\Database']); + if (!$previous['database'] || !$func['database']) { $classparts = explode("\\", $func['class']); $callstack[] = array_pop($classparts).'::'.$func['function']; $previous = $func; } } elseif (!in_array($func['function'], $ignore)) { + $func['database'] = ($func['function'] == 'q'); $callstack[] = $func['function']; $func['class'] = ''; $previous = $func;