@@ -20,56 +20,56 @@ |
||
| 20 | 20 | |
| 21 | 21 | class PatchInstaller3 implements PackageInstallerInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * (non-PHPdoc) |
|
| 25 | - * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
| 26 | - * @param MoufManager $moufManager |
|
| 27 | - * @throws \Mouf\MoufException |
|
| 28 | - */ |
|
| 29 | - public static function install(MoufManager $moufManager) |
|
| 30 | - { |
|
| 31 | - // Let's create the instance. |
|
| 32 | - $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
| 33 | - $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
| 34 | - $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
| 23 | + /** |
|
| 24 | + * (non-PHPdoc) |
|
| 25 | + * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
| 26 | + * @param MoufManager $moufManager |
|
| 27 | + * @throws \Mouf\MoufException |
|
| 28 | + */ |
|
| 29 | + public static function install(MoufManager $moufManager) |
|
| 30 | + { |
|
| 31 | + // Let's create the instance. |
|
| 32 | + $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
| 33 | + $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
| 34 | + $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
| 35 | 35 | |
| 36 | - $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
| 37 | - $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
| 38 | - $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
| 36 | + $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
| 37 | + $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
| 38 | + $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
| 39 | 39 | |
| 40 | - $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
| 40 | + $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
| 41 | 41 | |
| 42 | - if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
| 43 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 44 | - } |
|
| 42 | + if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
| 43 | + $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $consoleUtils = new ConsoleUtils($moufManager); |
|
| 46 | + $consoleUtils = new ConsoleUtils($moufManager); |
|
| 47 | 47 | |
| 48 | - $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
| 49 | - $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 50 | - $consoleUtils->registerCommand($listPatchesCommand); |
|
| 48 | + $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
| 49 | + $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 50 | + $consoleUtils->registerCommand($listPatchesCommand); |
|
| 51 | 51 | |
| 52 | - $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
| 53 | - $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 54 | - $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
| 52 | + $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
| 53 | + $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 54 | + $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
| 55 | 55 | |
| 56 | - $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
| 57 | - $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 58 | - $consoleUtils->registerCommand($applyPatchCommand); |
|
| 56 | + $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
| 57 | + $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 58 | + $consoleUtils->registerCommand($applyPatchCommand); |
|
| 59 | 59 | |
| 60 | - $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
| 61 | - $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 62 | - $consoleUtils->registerCommand($skipPatchCommand); |
|
| 60 | + $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
| 61 | + $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 62 | + $consoleUtils->registerCommand($skipPatchCommand); |
|
| 63 | 63 | |
| 64 | - $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
| 65 | - $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 66 | - $consoleUtils->registerCommand($revertPatchCommand); |
|
| 64 | + $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
| 65 | + $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 66 | + $consoleUtils->registerCommand($revertPatchCommand); |
|
| 67 | 67 | |
| 68 | - $resetPatchCommand = $moufManager->createInstance(ResetPatchesCommand::class); |
|
| 69 | - $resetPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 70 | - $consoleUtils->registerCommand($resetPatchCommand); |
|
| 68 | + $resetPatchCommand = $moufManager->createInstance(ResetPatchesCommand::class); |
|
| 69 | + $resetPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 70 | + $consoleUtils->registerCommand($resetPatchCommand); |
|
| 71 | 71 | |
| 72 | - // Let's rewrite the MoufComponents.php file to save the component |
|
| 73 | - $moufManager->rewriteMouf(); |
|
| 74 | - } |
|
| 72 | + // Let's rewrite the MoufComponents.php file to save the component |
|
| 73 | + $moufManager->rewriteMouf(); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
| 40 | 40 | |
| 41 | 41 | if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
| 42 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 42 | + $patchService->getConstructorArgumentProperty('types')->setValue([$patchDefaultType, $patchTestDataType]); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $consoleUtils = new ConsoleUtils($moufManager); |
@@ -8,16 +8,16 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface PatchListenerInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Triggered when the 'reset()' method is called on the PatchService |
|
| 13 | - */ |
|
| 14 | - public function onReset(): void; |
|
| 11 | + /** |
|
| 12 | + * Triggered when the 'reset()' method is called on the PatchService |
|
| 13 | + */ |
|
| 14 | + public function onReset(): void; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Triggered when one or many patches have been applied. |
|
| 18 | - * |
|
| 19 | - * @param PatchInterface[] $patches |
|
| 20 | - */ |
|
| 21 | - //public function onPatchesApplied(array $patches): void; |
|
| 16 | + /** |
|
| 17 | + * Triggered when one or many patches have been applied. |
|
| 18 | + * |
|
| 19 | + * @param PatchInterface[] $patches |
|
| 20 | + */ |
|
| 21 | + //public function onPatchesApplied(array $patches): void; |
|
| 22 | 22 | |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | if ($this->nbAwaiting != 0 || $this->nbError != 0) { |
| 21 | 21 | echo '<button name="action" value="apply" class="btn btn-large btn-success patch-run-all"><i class="icon-arrow-right icon-white"></i> Apply '; |
| 22 | 22 | if ($this->nbAwaiting != 0) { |
| 23 | - echo $this->nbAwaiting." awaiting patch".(($this->nbAwaiting != 1)?"es":""); |
|
| 23 | + echo $this->nbAwaiting." awaiting patch".(($this->nbAwaiting != 1) ? "es" : ""); |
|
| 24 | 24 | if ($this->nbError != 0) { |
| 25 | 25 | echo " and "; |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | if ($this->nbError != 0) { |
| 29 | - echo $this->nbError." patch".(($this->nbError != 1)?"es":"")." in error"; |
|
| 29 | + echo $this->nbError." patch".(($this->nbError != 1) ? "es" : "")." in error"; |
|
| 30 | 30 | } |
| 31 | 31 | echo '</button>'; |
| 32 | 32 | } |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | <td> |
| 71 | 71 | <?php |
| 72 | 72 | |
| 73 | - echo '<button class="btn btn-mini btn-success patch-apply" '.(($patch['status'] == PatchInterface::STATUS_APPLIED)?'disabled="disabled"':'').'><i class="icon-arrow-right icon-white"></i> Apply</button>'; |
|
| 74 | - echo ' <button class="btn btn-mini btn-info patch-skip" '.(($patch['status'] == PatchInterface::STATUS_APPLIED || $patch['status'] == PatchInterface::STATUS_SKIPPED)?'disabled="disabled"':'').'><i class="icon-share-alt icon-white"></i> Skip</button>'; |
|
| 73 | + echo '<button class="btn btn-mini btn-success patch-apply" '.(($patch['status'] == PatchInterface::STATUS_APPLIED) ? 'disabled="disabled"' : '').'><i class="icon-arrow-right icon-white"></i> Apply</button>'; |
|
| 74 | + echo ' <button class="btn btn-mini btn-info patch-skip" '.(($patch['status'] == PatchInterface::STATUS_APPLIED || $patch['status'] == PatchInterface::STATUS_SKIPPED) ? 'disabled="disabled"' : '').'><i class="icon-share-alt icon-white"></i> Skip</button>'; |
|
| 75 | 75 | if ($patch['canRevert']) { |
| 76 | - echo ' <button class="btn btn-mini btn-inverse patch-revert" '.(($patch['status'] == PatchInterface::STATUS_AWAITING)?'disabled="disabled"':'').'><i class="icon-arrow-left icon-white"></i> Revert</button>'; |
|
| 76 | + echo ' <button class="btn btn-mini btn-inverse patch-revert" '.(($patch['status'] == PatchInterface::STATUS_AWAITING) ? 'disabled="disabled"' : '').'><i class="icon-arrow-left icon-white"></i> Revert</button>'; |
|
| 77 | 77 | } |
| 78 | 78 | if ($patch['edit_url']) { |
| 79 | 79 | echo ' <a class="btn btn-mini btn-danger patch-edit" href="'.ROOT_URL.$patch['edit_url'].'"><i class="icon-edit icon-white"></i> Edit</a>'; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | <tr> |
| 87 | 87 | <td colspan="4"> |
| 88 | 88 | <div class="alert alert-error"> |
| 89 | - <strong>Last error message</strong>: <?php echo plainstring_to_htmlprotected($patch['error_message']);?> |
|
| 89 | + <strong>Last error message</strong>: <?php echo plainstring_to_htmlprotected($patch['error_message']); ?> |
|
| 90 | 90 | </div> |
| 91 | 91 | </td> |
| 92 | 92 | </tr> |
@@ -5,7 +5,8 @@ discard block |
||
| 5 | 5 | <?php if (empty($this->patchesArray)): ?> |
| 6 | 6 | <div class="alert alert-info">No patches have been registered yet.</div> |
| 7 | 7 | <?php |
| 8 | -else: |
|
| 8 | +else { |
|
| 9 | + : |
|
| 9 | 10 | |
| 10 | 11 | if ($this->nbAwaiting == 0 && $this->nbError == 0) { |
| 11 | 12 | ?> |
@@ -14,7 +15,9 @@ discard block |
||
| 14 | 15 | } |
| 15 | 16 | ?> |
| 16 | 17 | <form action="runAllPatches" method="post"> |
| 17 | - <input name="name" type="hidden" value="<?php echo plainstring_to_htmlprotected($this->instanceName); ?>"></input> |
|
| 18 | + <input name="name" type="hidden" value="<?php echo plainstring_to_htmlprotected($this->instanceName); |
|
| 19 | +} |
|
| 20 | +?>"></input> |
|
| 18 | 21 | <input name="selfedit" type="hidden" value="<?php echo plainstring_to_htmlprotected($this->selfedit); ?>"></input> |
| 19 | 22 | <?php |
| 20 | 23 | if ($this->nbAwaiting != 0 || $this->nbError != 0) { |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | <input name="selfedit" type="hidden" value="<?php echo plainstring_to_htmlprotected($this->selfedit); ?>"></input> |
| 15 | 15 | <input name="action" type="hidden" value="<?php echo plainstring_to_htmlprotected($this->action); ?>"></input> |
| 16 | 16 | <?php foreach ($this->nbPatchesByType as $name => $number): ?> |
| 17 | - <label class="checkbox"><input type="checkbox" name="types[]" value="<?= plainstring_to_htmlprotected($name) ?>" <?php if ($name == '') { echo "checked readonly"; } ?> /> <?= plainstring_to_htmlprotected($name?:'default') ?> (<?= $number ?> patch<?= $number > 1 ? 'es':'' ?>)</label> |
|
| 17 | + <label class="checkbox"><input type="checkbox" name="types[]" value="<?= plainstring_to_htmlprotected($name) ?>" <?php if ($name == '') { echo "checked readonly"; } ?> /> <?= plainstring_to_htmlprotected($name ?: 'default') ?> (<?= $number ?> patch<?= $number > 1 ? 'es' : '' ?>)</label> |
|
| 18 | 18 | <?php endforeach; ?> |
| 19 | 19 | |
| 20 | 20 | <?php if ($this->action === 'reset'): ?> |
@@ -3,9 +3,12 @@ discard block |
||
| 3 | 3 | <?php if ($this->action === 'reset'): ?> |
| 4 | 4 | <h1>Reset database</h1> |
| 5 | 5 | <div class="alert alert-danger"><strong>Warning!</strong> You are about to reset your complete database!</div> |
| 6 | -<?php else: ?> |
|
| 6 | +<?php else { |
|
| 7 | + : ?> |
|
| 7 | 8 | <h1>Apply patches</h1> |
| 8 | -<?php endif; ?> |
|
| 9 | +<?php endif; |
|
| 10 | +} |
|
| 11 | +?> |
|
| 9 | 12 | |
| 10 | 13 | Please select the patch types you want to apply: |
| 11 | 14 | |
@@ -19,7 +22,10 @@ discard block |
||
| 19 | 22 | |
| 20 | 23 | <?php if ($this->action === 'reset'): ?> |
| 21 | 24 | <button class="btn btn-large btn-danger"><i class="icon-remove icon-white"></i> Yes, I want to reset the database</button> |
| 22 | - <?php else: ?> |
|
| 25 | + <?php else { |
|
| 26 | + : ?> |
|
| 23 | 27 | <button class="btn btn-large btn-success"><i class="icon-arrow-right icon-white"></i> Apply selected patches</button> |
| 24 | - <?php endif; ?> |
|
| 28 | + <?php endif; |
|
| 29 | +} |
|
| 30 | +?> |
|
| 25 | 31 | </form> |
| 26 | 32 | \ No newline at end of file |