diff --git a/CHANGELOG.md b/CHANGELOG.md index eefad581a3..28d591b429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Update symfony components to version 5 - Change translations loading source for themes to be same as for core and modules - Turn off `autocomplete` for SMTP fields in admin template [PR-794](https://github.com/OXID-eSales/oxideshop_ce/pull/794) +- Load only necessary config options [PR-787](https://github.com/OXID-eSales/oxideshop_ce/pull/787) ### Deprecated - `\OxidEsales\EshopCommunity\Core\Controller\BaseController::getConfig` diff --git a/source/Core/Config.php b/source/Core/Config.php index 0c3db39b75..27579daae9 100644 --- a/source/Core/Config.php +++ b/source/Core/Config.php @@ -399,8 +399,8 @@ public function initVars($shopId) $this->_loadVarsFromDb($shopId, null, Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme')); } - // loading modules config - $this->_loadVarsFromDb($shopId, null, Config::OXMODULE_MODULE_PREFIX); + // loading all modules config + $this->_loadVarsFromDb($shopId, null, Config::OXMODULE_MODULE_PREFIX . '%'); $this->loadAdditionalConfiguration(); @@ -559,20 +559,15 @@ protected function _loadVarsFromDb($shopId, $onlyVars = null, $module = '') // p $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $params = [ - ':oxshopid' => $shopId + ':oxshopid' => $shopId, + ':oxmodule' => $module ]; - $select = "select - oxvarname, oxvartype, oxvarvalue - from oxconfig - where oxshopid = :oxshopid and "; - - if ($module) { - $select .= " oxmodule LIKE :oxmodule"; - $params[':oxmodule'] = $module . "%"; - } else { - $select .= "oxmodule = ''"; - } + $select = " + SELECT oxvarname, oxvartype, oxvarvalue + FROM oxconfig + WHERE oxshopid = :oxshopid AND oxmodule LIKE :oxmodule + "; $select .= $this->_getConfigParamsSelectSnippet($onlyVars); $result = $db->getAll($select, $params);