Skip to content

Commit

Permalink
Merge pull request #787 from JaroslavHerber/patch-1
Browse files Browse the repository at this point in the history
More config-records are selected than it should
  • Loading branch information
realFlowControl authored May 14, 2020
2 parents 3505fa7 + 7d4da5d commit 87f0376
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
23 changes: 9 additions & 14 deletions source/Core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 87f0376

Please sign in to comment.