Skip to content

Commit

Permalink
Merge pull request #26 from alfredbez/feature-add-shop-id-parameter
Browse files Browse the repository at this point in the history
feature: add shop parameter
  • Loading branch information
keywan-ghadami-oxid authored Jan 30, 2020
2 parents ba59a90 + 9e74ddf commit d3c2bf3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Core/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

abstract class CommandBase
{
/**
* @var bool Should the command run for all shops?
*/
protected $allShops = true;

/**
* @var array Shop-IDs the command has to run on
*/
protected $shops = [];

/**
* @var string The environment we are working on.
*/
Expand Down Expand Up @@ -79,6 +89,10 @@ protected function init()
exit;
}
$this->sEnv = $this->input->getOption('env');
if ($this->input->getOption('shop')) {
$this->shops = array_map('intval', explode(',', $this->input->getOption('shop')));
$this->allShops = false;
}
$this->setDebugOutput();
$this->initConfiguration();
$aConfigIntersect = array_intersect($this->aConfiguration['excludeFields'], $this->aConfiguration['envFields']);
Expand Down
4 changes: 3 additions & 1 deletion Core/ConfigImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ protected function importConfigValues($aConfigValues)
$oldVersion = $modulesKnownBeforeImport[$sModuleId];
$versionToImport = $aModuleVersions[$sModuleId];


$gt = version_compare($versionToImport, $oldVersion,'>');
if ($gt) {
$updatedModules[$sModuleId] = $sModuleId;
Expand Down Expand Up @@ -653,6 +652,9 @@ protected function importThemeConfig($aThemes)
protected function runShopConfigImportForAllShops($aShops)
{
foreach ($aShops as $sShop => $sFileName) {
if (!$this->allShops && !in_array($sShop, $this->shops)) {
continue;
}
$this->sShopId = $sShop;
$this->storedVarTypes = $this->getStoredVarTypes();
$this->runShopConfigImportForOneShop($sShop, $sFileName);
Expand Down

0 comments on commit d3c2bf3

Please sign in to comment.