diff --git a/src/Insulin/Console/Command/RepairRebuildCommand.php b/src/Insulin/Console/Command/RepairRebuildCommand.php new file mode 100644 index 0000000..3e0711c --- /dev/null +++ b/src/Insulin/Console/Command/RepairRebuildCommand.php @@ -0,0 +1,76 @@ +setName('repair-rebuild') + ->setAliases(array('rr')) + ->setDefinition(array( + new InputArgument('module', InputArgument::IS_ARRAY, 'The specific module name to repair and rebuild.'), + new InputOption('database-schema-changes', null, InputOption::VALUE_OPTIONAL, 'How database schema changes should be handled.', 'print'), + )) + ->setDescription('Repair and rebuild modules related structures.') + ->setHelp( + <<%command.name% performs the following generalized steps: + +* Clears cache so that files are rebuilt. +* Goes through custom/Extensions and rebuilds all layoutdefs, vardefs and language files. +* Ensure list of audited fields is correct. +* Compares database schema against vardefs. + + %command.full_name% + +By default, if any database schema changes are detected they are printed on screen. +You can change the way how the changes are handled by using the --database-schema-changes option: + + %command.full_name% --database-schema-changes=print + +Available handlers allow you to apply all database schema changes at once, print them on screen and review them all by running a step by step process. +EOF + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $modules = $input->getArgument('module'); + $noInteraction = $input->getOption('no-interaction'); + $databaseSchemaChanges = $input->getOption('database-schema-changes'); + + if ($noInteraction && $databaseSchemaChanges === 'step') { + $databaseSchemaChanges = 'print'; + } + } +}