Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

added -s or --skip-settings flag to fix:states command #47

Closed
wants to merge 1 commit into from
Closed
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 @@ -4,6 +4,7 @@ To get the diff for a specific change, go to https://github.com/EllisV/oxid-cons
To get the diff between two versions, go to https://github.com/EllisV/oxid-console/compare/v1.2.4...v1.2.5

* 1.2.6 (not released yet)
* added `-s` or `--skip-settings` flag to `fix:states` command
* (9a94f32) Support camel cased command file names

* 1.2.5 (2016-11-25)
Expand Down
13 changes: 8 additions & 5 deletions copy_this/application/commands/fixstatescommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ public function help(oxIOutput $oOutput)
$oOutput->writeLn('This command fixes information stored in database of modules');
$oOutput->writeln();
$oOutput->writeLn('Available options:');
$oOutput->writeLn(' -a, --all Passes all modules');
$oOutput->writeLn(' -b, --base-shop Fix only on base shop');
$oOutput->writeLn(' --shop=<shop_id> Specifies in which shop to fix states');
$oOutput->writeLn(' -n, --no-debug No debug output');
$oOutput->writeLn(' -a, --all Passes all modules');
$oOutput->writeLn(' -b, --base-shop Fix only on base shop');
$oOutput->writeLn(' --shop=<shop_id> Specifies in which shop to fix states');
$oOutput->writeLn(' -n, --no-debug No debug output');
$oOutput->writeLn(' -s, --skip-settings Don\'t reset module settings');
}

/**
Expand All @@ -55,6 +56,8 @@ public function execute(oxIOutput $oOutput)
? oxNew('oxNullOutput')
: $oOutput;

$resetSettings = !$oInput->hasOption(array('s', 'skip-settings'));

try {
$aModuleIds = $this->_parseModuleIds();
$aShopConfigs = $this->_parseShopConfigs();
Expand All @@ -80,7 +83,7 @@ public function execute(oxIOutput $oOutput)
}

$oDebugOutput->writeLn("[DEBUG] Fixing {$sModuleId} module");
$oModuleStateFixer->fix($oModule, $oConfig);
$oModuleStateFixer->fix($oModule, $oConfig, $resetSettings);
}

$oDebugOutput->writeLn();
Expand Down
6 changes: 4 additions & 2 deletions copy_this/core/oxmodulestatefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class oxModuleStateFixer extends oxModuleInstaller
* @param oxModule $oModule
* @param oxConfig|null $oConfig If not passed uses default base shop config
*/
public function fix(oxModule $oModule, oxConfig $oConfig = null)
public function fix(oxModule $oModule, oxConfig $oConfig = null, $resetSettings = true)
{
if ($oConfig !== null) {
$this->setConfig($oConfig);
Expand All @@ -40,7 +40,9 @@ public function fix(oxModule $oModule, oxConfig $oConfig = null)
$this->_addTemplateBlocks($oModule->getInfo("blocks"), $sModuleId);
$this->_addModuleFiles($oModule->getInfo("files"), $sModuleId);
$this->_addTemplateFiles($oModule->getInfo("templates"), $sModuleId);
$this->_addModuleSettings($oModule->getInfo("settings"), $sModuleId);
if ($resetSettings) {
$this->_addModuleSettings($oModule->getInfo("settings"), $sModuleId);
}
$this->_addModuleVersion($oModule->getInfo("version"), $sModuleId);
$this->_addModuleEvents($oModule->getInfo("events"), $sModuleId);

Expand Down