N°7646 - Check performances compared to beginning of 3.2 development (#659)

- Improve OQL calls in portal services list pages with a cached private key for encoding rules
This commit is contained in:
Benjamin Dalsass
2024-07-24 10:43:29 +02:00
committed by GitHub
parent ed7411294e
commit 3c8a71f39f

View File

@@ -63,6 +63,9 @@ class ContextManipulatorHelper
/** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper */
private $oScopeValidator;
/** @var string $sPrivateKey private key for encoding rules */
private static $sPrivateKey;
/**
* ContextManipulatorHelper constructor.
*
@@ -593,12 +596,13 @@ class ContextManipulatorHelper
*/
private static function GetPrivateKey()
{
$sPrivateKey = DBProperty::GetProperty(self::PRIVATE_KEY);
if (is_null($sPrivateKey)) {
$sPrivateKey = bin2hex(random_bytes(32));
DBProperty::SetProperty(self::PRIVATE_KEY, $sPrivateKey);
if(self::$sPrivateKey === null) {
self::$sPrivateKey = DBProperty::GetProperty(self::PRIVATE_KEY);
if (is_null(self::$sPrivateKey)) {
self::$sPrivateKey = bin2hex(random_bytes(32));
DBProperty::SetProperty(self::PRIVATE_KEY, self::$sPrivateKey);
}
}
return $sPrivateKey;
return self::$sPrivateKey;
}
}