Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More config-records are selected than it should #787

Merged
merged 5 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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