N°3985 - Performance checks on the back end - Enhance KPIs

This commit is contained in:
Eric Espie
2021-09-09 17:21:50 +02:00
parent 27c397cc1a
commit 15e99a898e
22 changed files with 119 additions and 78 deletions

View File

@@ -58,6 +58,10 @@ class ApplicationMenu
* @var array
*/
static $aMenusIndex = array();
/**
* @var array
*/
static $aMenusById = [];
/**
* @var string
*/
@@ -166,6 +170,7 @@ class ApplicationMenu
$aBacktrace = debug_backtrace();
$sFile = isset($aBacktrace[2]["file"]) ? $aBacktrace[2]["file"] : $aBacktrace[1]["file"];
self::$aMenusIndex[$index] = array('node' => $oMenuNode, 'children' => array(), 'parent' => $sParentId, 'rank' => $fRank, 'source_file' => $sFile);
self::$aMenusById[$oMenuNode->GetMenuId()] = $index;
}
else
{
@@ -506,17 +511,11 @@ EOF
*/
public static function GetMenuIndexById($sTitle)
{
$index = -1;
/** @var MenuNode[] $aMenu */
foreach(self::$aMenusIndex as $aMenu)
{
if ($aMenu['node']->GetMenuId() == $sTitle)
{
$index = $aMenu['node']->GetIndex();
break;
}
if (isset(self::$aMenusById[$sTitle])) {
return self::$aMenusById[$sTitle];
}
return $index;
return -1;
}
/**