@@ -32,47 +32,47 @@ discard block |
||
| 32 | 32 | * @ExtendedAction {"name":"View patches list", "url":"patcher/", "default":false} |
| 33 | 33 | */ |
| 34 | 34 | class PatchService implements MoufValidatorInterface, DumpableInterface { |
| 35 | - const IFEXISTS_EXCEPTION = "exception"; |
|
| 36 | - const IFEXISTS_IGNORE = "ignore"; |
|
| 35 | + const IFEXISTS_EXCEPTION = "exception"; |
|
| 36 | + const IFEXISTS_IGNORE = "ignore"; |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 39 | + /** |
|
| 40 | 40 | * The list of patches declared for this application. |
| 41 | 41 | * |
| 42 | 42 | * @var PatchInterface[] |
| 43 | 43 | */ |
| 44 | 44 | private $patchs = []; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * The list of exiting patch types for this application. |
|
| 48 | - * |
|
| 49 | - * @var PatchType[] |
|
| 50 | - */ |
|
| 46 | + /** |
|
| 47 | + * The list of exiting patch types for this application. |
|
| 48 | + * |
|
| 49 | + * @var PatchType[] |
|
| 50 | + */ |
|
| 51 | 51 | private $types = []; |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * The list of listeners on the patch service. |
|
| 55 | - * |
|
| 56 | - * @var array|PatchListenerInterface[] |
|
| 57 | - */ |
|
| 58 | - private $listeners; |
|
| 53 | + /** |
|
| 54 | + * The list of listeners on the patch service. |
|
| 55 | + * |
|
| 56 | + * @var array|PatchListenerInterface[] |
|
| 57 | + */ |
|
| 58 | + private $listeners; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var DumperInterface |
|
| 62 | - */ |
|
| 63 | - private $dumper; |
|
| 60 | + /** |
|
| 61 | + * @var DumperInterface |
|
| 62 | + */ |
|
| 63 | + private $dumper; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @param PatchType[] $types |
|
| 67 | - * @param PatchListenerInterface[] $listeners |
|
| 68 | - */ |
|
| 69 | - public function __construct(array $types, array $listeners = []) |
|
| 70 | - { |
|
| 71 | - $this->types = $types; |
|
| 72 | - $this->listeners = $listeners; |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * @param PatchType[] $types |
|
| 67 | + * @param PatchListenerInterface[] $listeners |
|
| 68 | + */ |
|
| 69 | + public function __construct(array $types, array $listeners = []) |
|
| 70 | + { |
|
| 71 | + $this->types = $types; |
|
| 72 | + $this->listeners = $listeners; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | + /** |
|
| 76 | 76 | * The list of patches declared for this application. |
| 77 | 77 | * @param PatchInterface[] $patchs |
| 78 | 78 | * @return PatchService |
@@ -82,26 +82,26 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * The list of exiting patch types for this application. |
|
| 87 | - * |
|
| 88 | - * @return PatchType[] |
|
| 89 | - */ |
|
| 90 | - public function getTypes(): array |
|
| 91 | - { |
|
| 92 | - return $this->types; |
|
| 93 | - } |
|
| 85 | + /** |
|
| 86 | + * The list of exiting patch types for this application. |
|
| 87 | + * |
|
| 88 | + * @return PatchType[] |
|
| 89 | + */ |
|
| 90 | + public function getTypes(): array |
|
| 91 | + { |
|
| 92 | + return $this->types; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * @internal Returns a serialized list of types for the patch UI. |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 99 | - public function _getSerializedTypes(): array |
|
| 100 | - { |
|
| 101 | - return array_map(function(PatchType $type) { |
|
| 102 | - return $type->jsonSerialize(); |
|
| 103 | - }, $this->types); |
|
| 104 | - } |
|
| 95 | + /** |
|
| 96 | + * @internal Returns a serialized list of types for the patch UI. |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | + public function _getSerializedTypes(): array |
|
| 100 | + { |
|
| 101 | + return array_map(function(PatchType $type) { |
|
| 102 | + return $type->jsonSerialize(); |
|
| 103 | + }, $this->types); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Adds this patch to the list of existing patches. |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * Returns a PHP array representing the patchs. |
| 233 | - * |
|
| 234 | - * @internal |
|
| 233 | + * |
|
| 234 | + * @internal |
|
| 235 | 235 | */ |
| 236 | 236 | public function getView(): array { |
| 237 | 237 | $view = array(); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | "description"=>$description, |
| 266 | 266 | "error_message"=>$error_message, |
| 267 | 267 | "edit_url"=>$editUrl, |
| 268 | - "patch_type"=>$patchType |
|
| 268 | + "patch_type"=>$patchType |
|
| 269 | 269 | ); |
| 270 | 270 | $view[] = $patchView; |
| 271 | 271 | } |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | public function apply($uniqueName): void { |
| 280 | 280 | $patch = $this->get($uniqueName); |
| 281 | 281 | if ($patch instanceof DumpableInterface && $this->dumper !== null) { |
| 282 | - $patch->setDumper($this->dumper); |
|
| 283 | - } |
|
| 284 | - // TODO: in next major version, get rid of the DumpableInterface and pass the dumper right in the apply method. |
|
| 282 | + $patch->setDumper($this->dumper); |
|
| 283 | + } |
|
| 284 | + // TODO: in next major version, get rid of the DumpableInterface and pass the dumper right in the apply method. |
|
| 285 | 285 | $patch->apply(); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function skip($uniqueName): void { |
| 293 | 293 | $patch = $this->get($uniqueName); |
| 294 | - if ($patch instanceof DumpableInterface && $this->dumper !== null) { |
|
| 295 | - $patch->setDumper($this->dumper); |
|
| 296 | - } |
|
| 294 | + if ($patch instanceof DumpableInterface && $this->dumper !== null) { |
|
| 295 | + $patch->setDumper($this->dumper); |
|
| 296 | + } |
|
| 297 | 297 | $patch->skip(); |
| 298 | 298 | } |
| 299 | 299 | |
@@ -304,66 +304,66 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function revert($uniqueName): void { |
| 306 | 306 | $patch = $this->get($uniqueName); |
| 307 | - if ($patch instanceof DumpableInterface && $this->dumper !== null) { |
|
| 308 | - $patch->setDumper($this->dumper); |
|
| 309 | - } |
|
| 307 | + if ($patch instanceof DumpableInterface && $this->dumper !== null) { |
|
| 308 | + $patch->setDumper($this->dumper); |
|
| 309 | + } |
|
| 310 | 310 | $patch->revert(); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - /** |
|
| 314 | - * Apply all remaining patches (patches in state "awaiting" or in "error"). |
|
| 315 | - * The types of the patches can be passed as an array of string where the string is the name of the patch. |
|
| 316 | - * Patches with the "default" type are always applied. |
|
| 317 | - * |
|
| 318 | - * @param string[] $types |
|
| 319 | - * @return array An array containing 2 keys: "applied" and "skipped". Each key contains an associative array with the type of the patch and the number of patches of this type applied. |
|
| 320 | - */ |
|
| 313 | + /** |
|
| 314 | + * Apply all remaining patches (patches in state "awaiting" or in "error"). |
|
| 315 | + * The types of the patches can be passed as an array of string where the string is the name of the patch. |
|
| 316 | + * Patches with the "default" type are always applied. |
|
| 317 | + * |
|
| 318 | + * @param string[] $types |
|
| 319 | + * @return array An array containing 2 keys: "applied" and "skipped". Each key contains an associative array with the type of the patch and the number of patches of this type applied. |
|
| 320 | + */ |
|
| 321 | 321 | public function applyAll(array $types = []): array { |
| 322 | - // Array of count of applied and skipped patches. Key is the patch type. |
|
| 323 | - $appliedPatchArray = []; |
|
| 324 | - $skippedPatchArray = []; |
|
| 322 | + // Array of count of applied and skipped patches. Key is the patch type. |
|
| 323 | + $appliedPatchArray = []; |
|
| 324 | + $skippedPatchArray = []; |
|
| 325 | 325 | |
| 326 | - foreach ($this->patchs as $patch) { |
|
| 327 | - if ($patch->getStatus() === PatchInterface::STATUS_AWAITING || $patch->getStatus() === PatchInterface::STATUS_ERROR) { |
|
| 328 | - $type = $patch->getPatchType()->getName(); |
|
| 329 | - if ($type === '' || in_array($type, $types, true)) { |
|
| 330 | - $this->apply($patch->getUniqueName()); |
|
| 331 | - if (!isset($appliedPatchArray[$type])) { |
|
| 332 | - $appliedPatchArray[$type] = 0; |
|
| 333 | - } |
|
| 334 | - $appliedPatchArray[$type]++; |
|
| 335 | - } else { |
|
| 336 | - $this->skip($patch->getUniqueName()); |
|
| 337 | - if (!isset($skippedPatchArray[$type])) { |
|
| 338 | - $skippedPatchArray[$type] = 0; |
|
| 339 | - } |
|
| 340 | - $skippedPatchArray[$type]++; |
|
| 341 | - } |
|
| 342 | - } |
|
| 343 | - } |
|
| 326 | + foreach ($this->patchs as $patch) { |
|
| 327 | + if ($patch->getStatus() === PatchInterface::STATUS_AWAITING || $patch->getStatus() === PatchInterface::STATUS_ERROR) { |
|
| 328 | + $type = $patch->getPatchType()->getName(); |
|
| 329 | + if ($type === '' || in_array($type, $types, true)) { |
|
| 330 | + $this->apply($patch->getUniqueName()); |
|
| 331 | + if (!isset($appliedPatchArray[$type])) { |
|
| 332 | + $appliedPatchArray[$type] = 0; |
|
| 333 | + } |
|
| 334 | + $appliedPatchArray[$type]++; |
|
| 335 | + } else { |
|
| 336 | + $this->skip($patch->getUniqueName()); |
|
| 337 | + if (!isset($skippedPatchArray[$type])) { |
|
| 338 | + $skippedPatchArray[$type] = 0; |
|
| 339 | + } |
|
| 340 | + $skippedPatchArray[$type]++; |
|
| 341 | + } |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | - return [ |
|
| 346 | - 'applied' => $appliedPatchArray, |
|
| 347 | - 'skipped' => $skippedPatchArray |
|
| 348 | - ]; |
|
| 349 | - } |
|
| 345 | + return [ |
|
| 346 | + 'applied' => $appliedPatchArray, |
|
| 347 | + 'skipped' => $skippedPatchArray |
|
| 348 | + ]; |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - /** |
|
| 352 | - * Reset all patches to a not applied state. |
|
| 353 | - * |
|
| 354 | - * Note: this does NOT run the "revert" method on each patch but DOES trigger a "reset" event. |
|
| 355 | - */ |
|
| 351 | + /** |
|
| 352 | + * Reset all patches to a not applied state. |
|
| 353 | + * |
|
| 354 | + * Note: this does NOT run the "revert" method on each patch but DOES trigger a "reset" event. |
|
| 355 | + */ |
|
| 356 | 356 | public function reset(): void { |
| 357 | - foreach ($this->listeners as $listener) { |
|
| 358 | - if ($listener instanceof DumpableInterface && $this->dumper !== null) { |
|
| 359 | - $listener->setDumper($this->dumper); |
|
| 360 | - } |
|
| 361 | - $listener->onReset(); |
|
| 362 | - } |
|
| 363 | - } |
|
| 357 | + foreach ($this->listeners as $listener) { |
|
| 358 | + if ($listener instanceof DumpableInterface && $this->dumper !== null) { |
|
| 359 | + $listener->setDumper($this->dumper); |
|
| 360 | + } |
|
| 361 | + $listener->onReset(); |
|
| 362 | + } |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | - public function setDumper(DumperInterface $dumper) |
|
| 366 | - { |
|
| 367 | - $this->dumper = $dumper; |
|
| 368 | - } |
|
| 365 | + public function setDumper(DumperInterface $dumper) |
|
| 366 | + { |
|
| 367 | + $this->dumper = $dumper; |
|
| 368 | + } |
|
| 369 | 369 | } |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface DumpableInterface |
| 10 | 10 | { |
| 11 | - public function setDumper(DumperInterface $dumper); |
|
| 11 | + public function setDumper(DumperInterface $dumper); |
|
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -8,18 +8,18 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Dumper implements DumperInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @var OutputInterface |
|
| 13 | - */ |
|
| 14 | - private $output; |
|
| 11 | + /** |
|
| 12 | + * @var OutputInterface |
|
| 13 | + */ |
|
| 14 | + private $output; |
|
| 15 | 15 | |
| 16 | - public function __construct(OutputInterface $output) |
|
| 17 | - { |
|
| 18 | - $this->output = $output; |
|
| 19 | - } |
|
| 16 | + public function __construct(OutputInterface $output) |
|
| 17 | + { |
|
| 18 | + $this->output = $output; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function dumpPatch(string $code): void |
|
| 22 | - { |
|
| 23 | - $this->output->writeln($code); |
|
| 24 | - } |
|
| 21 | + public function dumpPatch(string $code): void |
|
| 22 | + { |
|
| 23 | + $this->output->writeln($code); |
|
| 24 | + } |
|
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -6,5 +6,5 @@ |
||
| 6 | 6 | |
| 7 | 7 | interface DumperInterface |
| 8 | 8 | { |
| 9 | - public function dumpPatch(string $code): void; |
|
| 9 | + public function dumpPatch(string $code): void; |
|
| 10 | 10 | } |
@@ -16,51 +16,51 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class RevertPatchCommand extends Command |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * @var PatchService |
|
| 21 | - */ |
|
| 22 | - private $patchService; |
|
| 19 | + /** |
|
| 20 | + * @var PatchService |
|
| 21 | + */ |
|
| 22 | + private $patchService; |
|
| 23 | 23 | |
| 24 | - public function __construct(PatchService $patchService) |
|
| 25 | - { |
|
| 26 | - parent::__construct(); |
|
| 27 | - $this->patchService = $patchService; |
|
| 28 | - } |
|
| 24 | + public function __construct(PatchService $patchService) |
|
| 25 | + { |
|
| 26 | + parent::__construct(); |
|
| 27 | + $this->patchService = $patchService; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - protected function configure() |
|
| 35 | - { |
|
| 36 | - $this |
|
| 37 | - ->setName('patches:revert') |
|
| 38 | - ->setDescription('Revert a patch.') |
|
| 39 | - ->addArgument( |
|
| 40 | - 'name', |
|
| 41 | - InputArgument::REQUIRED, |
|
| 42 | - 'The name of the patch instance to be reverted' |
|
| 43 | - ) |
|
| 44 | - ->setHelp(<<<EOT |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + protected function configure() |
|
| 35 | + { |
|
| 36 | + $this |
|
| 37 | + ->setName('patches:revert') |
|
| 38 | + ->setDescription('Revert a patch.') |
|
| 39 | + ->addArgument( |
|
| 40 | + 'name', |
|
| 41 | + InputArgument::REQUIRED, |
|
| 42 | + 'The name of the patch instance to be reverted' |
|
| 43 | + ) |
|
| 44 | + ->setHelp(<<<EOT |
|
| 45 | 45 | Reverts a patch. You must pass in parameter the name of the patch. |
| 46 | 46 | EOT |
| 47 | - ); |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | - $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The patch will still be reverted.'); |
|
| 50 | - } |
|
| 49 | + $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The patch will still be reverted.'); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * {@inheritdoc} |
|
| 54 | - */ |
|
| 55 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 56 | - { |
|
| 57 | - if ($input->getOption('dump')) { |
|
| 58 | - $this->patchService->setDumper(new Dumper($output)); |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * {@inheritdoc} |
|
| 54 | + */ |
|
| 55 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 56 | + { |
|
| 57 | + if ($input->getOption('dump')) { |
|
| 58 | + $this->patchService->setDumper(new Dumper($output)); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - $patchName = $input->getArgument('name'); |
|
| 62 | - $this->patchService->revert($patchName); |
|
| 61 | + $patchName = $input->getArgument('name'); |
|
| 62 | + $this->patchService->revert($patchName); |
|
| 63 | 63 | |
| 64 | - $output->writeln('Patch successfully reverted'); |
|
| 65 | - } |
|
| 64 | + $output->writeln('Patch successfully reverted'); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -16,54 +16,54 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class ApplyPatchCommand extends Command |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * @var PatchService |
|
| 21 | - */ |
|
| 22 | - private $patchService; |
|
| 19 | + /** |
|
| 20 | + * @var PatchService |
|
| 21 | + */ |
|
| 22 | + private $patchService; |
|
| 23 | 23 | |
| 24 | - public function __construct(PatchService $patchService) |
|
| 25 | - { |
|
| 26 | - parent::__construct(); |
|
| 27 | - $this->patchService = $patchService; |
|
| 28 | - } |
|
| 24 | + public function __construct(PatchService $patchService) |
|
| 25 | + { |
|
| 26 | + parent::__construct(); |
|
| 27 | + $this->patchService = $patchService; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - protected function configure() |
|
| 35 | - { |
|
| 36 | - $this |
|
| 37 | - ->setName('patches:apply') |
|
| 38 | - ->setDescription('Apply a patch.') |
|
| 39 | - ->addArgument( |
|
| 40 | - 'name', |
|
| 41 | - InputArgument::REQUIRED, |
|
| 42 | - 'The name of the patch instance to be applied' |
|
| 43 | - ) |
|
| 44 | - ->setHelp(<<<EOT |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + protected function configure() |
|
| 35 | + { |
|
| 36 | + $this |
|
| 37 | + ->setName('patches:apply') |
|
| 38 | + ->setDescription('Apply a patch.') |
|
| 39 | + ->addArgument( |
|
| 40 | + 'name', |
|
| 41 | + InputArgument::REQUIRED, |
|
| 42 | + 'The name of the patch instance to be applied' |
|
| 43 | + ) |
|
| 44 | + ->setHelp(<<<EOT |
|
| 45 | 45 | Apply a patch. You must pass in parameter the name of the patch. |
| 46 | 46 | |
| 47 | 47 | Use patches:apply-all to apply all pending patches. |
| 48 | 48 | EOT |
| 49 | - ); |
|
| 49 | + ); |
|
| 50 | 50 | |
| 51 | - $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The patch will still be applied.'); |
|
| 52 | - } |
|
| 51 | + $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The patch will still be applied.'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * {@inheritdoc} |
|
| 56 | - */ |
|
| 57 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 58 | - { |
|
| 59 | - if ($input->getOption('dump')) { |
|
| 60 | - $this->patchService->setDumper(new Dumper($output)); |
|
| 61 | - } |
|
| 54 | + /** |
|
| 55 | + * {@inheritdoc} |
|
| 56 | + */ |
|
| 57 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 58 | + { |
|
| 59 | + if ($input->getOption('dump')) { |
|
| 60 | + $this->patchService->setDumper(new Dumper($output)); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - $patchName = $input->getArgument('name'); |
|
| 65 | - $this->patchService->apply($patchName); |
|
| 64 | + $patchName = $input->getArgument('name'); |
|
| 65 | + $this->patchService->apply($patchName); |
|
| 66 | 66 | |
| 67 | - $output->writeln('Patch successfully applied'); |
|
| 68 | - } |
|
| 67 | + $output->writeln('Patch successfully applied'); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -16,40 +16,40 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class ResetPatchesCommand extends AbstractApplyAllCommand |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * {@inheritdoc} |
|
| 21 | - */ |
|
| 22 | - protected function configure() |
|
| 23 | - { |
|
| 24 | - $this |
|
| 25 | - ->setName('patches:reset') |
|
| 26 | - ->setDescription('Reset database and reapply all patches.') |
|
| 27 | - ->setDefinition(array( |
|
| 28 | - |
|
| 29 | - )) |
|
| 30 | - ->setHelp(<<<EOT |
|
| 19 | + /** |
|
| 20 | + * {@inheritdoc} |
|
| 21 | + */ |
|
| 22 | + protected function configure() |
|
| 23 | + { |
|
| 24 | + $this |
|
| 25 | + ->setName('patches:reset') |
|
| 26 | + ->setDescription('Reset database and reapply all patches.') |
|
| 27 | + ->setDefinition(array( |
|
| 28 | + |
|
| 29 | + )) |
|
| 30 | + ->setHelp(<<<EOT |
|
| 31 | 31 | Reset the database and reapplies all pending patches. You can select the type of patches to be applied using the options. Default patches are always applied. |
| 32 | 32 | |
| 33 | 33 | Use patches:apply-all if you want to apply remaining patches without resetting the database. |
| 34 | 34 | EOT |
| 35 | - ); |
|
| 35 | + ); |
|
| 36 | 36 | |
| 37 | - $this->registerOptions(); |
|
| 37 | + $this->registerOptions(); |
|
| 38 | 38 | |
| 39 | - $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The database will still be reset.'); |
|
| 40 | - } |
|
| 39 | + $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patch to the output. Note: this is not a "dry" mode. The database will still be reset.'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * {@inheritdoc} |
|
| 44 | - */ |
|
| 45 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 46 | - { |
|
| 47 | - if ($input->getOption('dump')) { |
|
| 48 | - $this->patchService->setDumper(new Dumper($output)); |
|
| 49 | - } |
|
| 42 | + /** |
|
| 43 | + * {@inheritdoc} |
|
| 44 | + */ |
|
| 45 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 46 | + { |
|
| 47 | + if ($input->getOption('dump')) { |
|
| 48 | + $this->patchService->setDumper(new Dumper($output)); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $this->patchService->reset(); |
|
| 51 | + $this->patchService->reset(); |
|
| 52 | 52 | |
| 53 | - $this->applyAll($input, $output); |
|
| 54 | - } |
|
| 53 | + $this->applyAll($input, $output); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -18,37 +18,37 @@ |
||
| 18 | 18 | { |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * {@inheritdoc} |
|
| 23 | - */ |
|
| 24 | - protected function configure() |
|
| 25 | - { |
|
| 26 | - $this |
|
| 27 | - ->setName('patches:apply-all') |
|
| 28 | - ->setDescription('Apply pending patches.') |
|
| 29 | - ->setDefinition(array( |
|
| 30 | - |
|
| 31 | - )) |
|
| 32 | - ->setHelp(<<<EOT |
|
| 21 | + /** |
|
| 22 | + * {@inheritdoc} |
|
| 23 | + */ |
|
| 24 | + protected function configure() |
|
| 25 | + { |
|
| 26 | + $this |
|
| 27 | + ->setName('patches:apply-all') |
|
| 28 | + ->setDescription('Apply pending patches.') |
|
| 29 | + ->setDefinition(array( |
|
| 30 | + |
|
| 31 | + )) |
|
| 32 | + ->setHelp(<<<EOT |
|
| 33 | 33 | Apply pending patches. You can select the type of patches to be applied using the options. Default patches are always applied. |
| 34 | 34 | |
| 35 | 35 | Use patches:apply if you want to cherry-pick a particular patch. |
| 36 | 36 | EOT |
| 37 | - ); |
|
| 38 | - |
|
| 39 | - $this->registerOptions(); |
|
| 40 | - |
|
| 41 | - $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patches to the output. Note: this is not a "dry" mode. The patches will still be applied.'); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * {@inheritdoc} |
|
| 46 | - */ |
|
| 47 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 48 | - { |
|
| 49 | - if ($input->getOption('dump')) { |
|
| 50 | - $this->patchService->setDumper(new Dumper($output)); |
|
| 51 | - } |
|
| 52 | - $this->applyAll($input, $output); |
|
| 53 | - } |
|
| 37 | + ); |
|
| 38 | + |
|
| 39 | + $this->registerOptions(); |
|
| 40 | + |
|
| 41 | + $this->addOption('dump', 'd', InputOption::VALUE_NONE, 'Dumps the patches to the output. Note: this is not a "dry" mode. The patches will still be applied.'); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * {@inheritdoc} |
|
| 46 | + */ |
|
| 47 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 48 | + { |
|
| 49 | + if ($input->getOption('dump')) { |
|
| 50 | + $this->patchService->setDumper(new Dumper($output)); |
|
| 51 | + } |
|
| 52 | + $this->applyAll($input, $output); |
|
| 53 | + } |
|
| 54 | 54 | } |