From 4ec789a63c999b5cd0585cebeb72b46f57a799be Mon Sep 17 00:00:00 2001 From: Semen Kuznetsov Date: Fri, 3 May 2024 15:40:53 +0300 Subject: [PATCH] Fixed looping of requests to settings --- models/CommonSettings.php | 25 +------------------------ updates/version.yaml | 2 ++ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/models/CommonSettings.php b/models/CommonSettings.php index f3a8b277..efafbfe6 100644 --- a/models/CommonSettings.php +++ b/models/CommonSettings.php @@ -37,29 +37,6 @@ class CommonSettings extends SettingModel */ public static function getValue($sCode, $sDefaultValue = null) { - if (empty($sCode)) { - return $sDefaultValue; - } - - if (isset(static::$arCacheValue[$sCode])) { - return static::$arCacheValue[$sCode]; - } - - //Get settings object - $obSettings = static::where('item', static::SETTINGS_CODE)->first(); - if (empty($obSettings)) { - static::$arCacheValue[$sCode] = static::get($sCode, $sDefaultValue); - - return static::$arCacheValue[$sCode]; - } - - $sValue = $obSettings->$sCode; - if ($sValue === null) { - return $sDefaultValue; - } - - static::$arCacheValue[$sCode] = $sValue; - - return $sValue; + return static::instance()->$sCode ?? $sDefaultValue; } } diff --git a/updates/version.yaml b/updates/version.yaml index ff0dcb79..1b4e3b83 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -126,3 +126,5 @@ - 'Fixed PageHelper class.' 2.1.3: - 'Revert fix of PageHelper class.' +2.1.4: + - 'Fixed looping of requests to settings. Thanks to dblackCat and Nikita Khaetsky.'