@@ -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 |
@@ -2,16 +2,7 @@ |
||
2 | 2 | namespace Mouf\Utils\Patcher\Controllers; |
3 | 3 | |
4 | 4 | use Mouf\Controllers\AbstractMoufInstanceController; |
5 | - |
|
6 | -use Mouf\Database\TDBM\Utils\TDBMDaoGenerator; |
|
7 | - |
|
8 | 5 | use Mouf\Html\Widgets\MessageService\Service\UserMessageInterface; |
9 | -use Mouf\MoufManager; |
|
10 | - |
|
11 | -use Mouf\Mvc\Splash\Controllers\Controller; |
|
12 | - |
|
13 | -use Mouf\Reflection\MoufReflectionProxy; |
|
14 | - |
|
15 | 6 | use Mouf\Html\HtmlElement\HtmlBlock; |
16 | 7 | use Mouf\InstanceProxy; |
17 | 8 | use Mouf\Utils\Patcher\PatchException; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @Action |
49 | 49 | * @Logged |
50 | 50 | */ |
51 | - public function defaultAction($name, $selfedit="false") { |
|
51 | + public function defaultAction($name, $selfedit = "false") { |
|
52 | 52 | $this->initController($name, $selfedit); |
53 | 53 | |
54 | 54 | $patchService = new InstanceProxy($name, $selfedit == "true"); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
195 | 195 | } |
196 | 196 | |
197 | - $msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr)); |
|
197 | + $msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1) ? 'es' : '', implode(', ', $patchArr)); |
|
198 | 198 | } |
199 | 199 | if ($nbPatchesSkipped !== 0) { |
200 | 200 | $patchArr = []; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
204 | 204 | } |
205 | 205 | |
206 | - $msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
206 | + $msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1) ? 'es' : '', implode(', ', $patchArr)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($msg !== '') { |
@@ -20,7 +20,6 @@ discard block |
||
20 | 20 | |
21 | 21 | /** |
22 | 22 | * The controller to track which patchs have been applied. |
23 | - |
|
24 | 23 | */ |
25 | 24 | class PatchController extends AbstractMoufInstanceController { |
26 | 25 | |
@@ -99,115 +98,115 @@ discard block |
||
99 | 98 | header('Location: .?name='.urlencode($name)); |
100 | 99 | } |
101 | 100 | |
102 | - /** |
|
103 | - * Displays the page to select the patch types to be applied. |
|
104 | - * |
|
105 | - * @Action |
|
106 | - * @Logged |
|
107 | - * @param string $name |
|
108 | - * @param string $selfedit |
|
109 | - * @param string $action One of "reset" or "apply" |
|
110 | - */ |
|
111 | - public function runAllPatches($name, $selfedit, $action) { |
|
112 | - $this->initController($name, $selfedit); |
|
113 | - |
|
114 | - $patchService = new InstanceProxy($name, $selfedit == "true"); |
|
115 | - $this->patchesArray = $patchService->getView(); |
|
116 | - |
|
117 | - $types = $patchService->_getSerializedTypes(); |
|
118 | - |
|
119 | - foreach ($types as $type) { |
|
120 | - $this->nbPatchesByType[$type['name']] = 0; |
|
121 | - } |
|
122 | - |
|
123 | - $nbNoneDefaultPatches = 0; |
|
124 | - |
|
125 | - foreach ($this->patchesArray as $patch) { |
|
126 | - if ($action === 'reset' || $patch['status'] === PatchInterface::STATUS_AWAITING || $patch['status'] === PatchInterface::STATUS_ERROR) { |
|
127 | - $type = $patch['patch_type']; |
|
128 | - if ($type !== '') { |
|
129 | - $nbNoneDefaultPatches++; |
|
130 | - } |
|
131 | - $this->nbPatchesByType[$type]++; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - // If all patches to be applied are default patches, let's do this right now. |
|
136 | - if ($nbNoneDefaultPatches === 0) { |
|
137 | - $this->applyAllPatches($name, [''], $action, $selfedit); |
|
138 | - return; |
|
139 | - } |
|
140 | - |
|
141 | - ksort($this->nbPatchesByType); |
|
142 | - |
|
143 | - $this->action = $action; |
|
144 | - |
|
145 | - // Otherwise, let's display a screen to select the patch types to be applied. |
|
146 | - $this->content->addFile(__DIR__."/../../../../views/applyPatches.php", $this); |
|
147 | - $this->template->toHtml(); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * Runs all patches in a row. |
|
153 | - * |
|
154 | - * @Action |
|
155 | - * @Logged |
|
156 | - * @param string $name |
|
157 | - * @param string[] $types |
|
158 | - * @param string $action One of "reset" or "apply" |
|
159 | - * @param string $selfedit |
|
160 | - */ |
|
101 | + /** |
|
102 | + * Displays the page to select the patch types to be applied. |
|
103 | + * |
|
104 | + * @Action |
|
105 | + * @Logged |
|
106 | + * @param string $name |
|
107 | + * @param string $selfedit |
|
108 | + * @param string $action One of "reset" or "apply" |
|
109 | + */ |
|
110 | + public function runAllPatches($name, $selfedit, $action) { |
|
111 | + $this->initController($name, $selfedit); |
|
112 | + |
|
113 | + $patchService = new InstanceProxy($name, $selfedit == "true"); |
|
114 | + $this->patchesArray = $patchService->getView(); |
|
115 | + |
|
116 | + $types = $patchService->_getSerializedTypes(); |
|
117 | + |
|
118 | + foreach ($types as $type) { |
|
119 | + $this->nbPatchesByType[$type['name']] = 0; |
|
120 | + } |
|
121 | + |
|
122 | + $nbNoneDefaultPatches = 0; |
|
123 | + |
|
124 | + foreach ($this->patchesArray as $patch) { |
|
125 | + if ($action === 'reset' || $patch['status'] === PatchInterface::STATUS_AWAITING || $patch['status'] === PatchInterface::STATUS_ERROR) { |
|
126 | + $type = $patch['patch_type']; |
|
127 | + if ($type !== '') { |
|
128 | + $nbNoneDefaultPatches++; |
|
129 | + } |
|
130 | + $this->nbPatchesByType[$type]++; |
|
131 | + } |
|
132 | + } |
|
133 | + |
|
134 | + // If all patches to be applied are default patches, let's do this right now. |
|
135 | + if ($nbNoneDefaultPatches === 0) { |
|
136 | + $this->applyAllPatches($name, [''], $action, $selfedit); |
|
137 | + return; |
|
138 | + } |
|
139 | + |
|
140 | + ksort($this->nbPatchesByType); |
|
141 | + |
|
142 | + $this->action = $action; |
|
143 | + |
|
144 | + // Otherwise, let's display a screen to select the patch types to be applied. |
|
145 | + $this->content->addFile(__DIR__."/../../../../views/applyPatches.php", $this); |
|
146 | + $this->template->toHtml(); |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * Runs all patches in a row. |
|
152 | + * |
|
153 | + * @Action |
|
154 | + * @Logged |
|
155 | + * @param string $name |
|
156 | + * @param string[] $types |
|
157 | + * @param string $action One of "reset" or "apply" |
|
158 | + * @param string $selfedit |
|
159 | + */ |
|
161 | 160 | public function applyAllPatches($name, array $types, $action, $selfedit) { |
162 | 161 | $patchService = new InstanceProxy($name, $selfedit == "true"); |
163 | 162 | /* @var $patchService PatchService */ |
164 | 163 | |
165 | - if ($action === 'reset') { |
|
166 | - $patchService->reset(); |
|
167 | - } |
|
168 | - try { |
|
164 | + if ($action === 'reset') { |
|
165 | + $patchService->reset(); |
|
166 | + } |
|
167 | + try { |
|
169 | 168 | |
170 | - [ |
|
171 | - 'applied' => $appliedPatchArray, |
|
172 | - 'skipped' => $skippedPatchArray |
|
173 | - ] = $patchService->applyAll($types); |
|
169 | + [ |
|
170 | + 'applied' => $appliedPatchArray, |
|
171 | + 'skipped' => $skippedPatchArray |
|
172 | + ] = $patchService->applyAll($types); |
|
174 | 173 | |
175 | - $this->displayNotificationMessage($appliedPatchArray, $skippedPatchArray); |
|
176 | - } catch (\Exception $e) { |
|
174 | + $this->displayNotificationMessage($appliedPatchArray, $skippedPatchArray); |
|
175 | + } catch (\Exception $e) { |
|
177 | 176 | $htmlMessage = "An error occured while applying the patch: ".$e->getMessage(); |
178 | 177 | set_user_message($htmlMessage); |
179 | 178 | } |
180 | 179 | |
181 | 180 | |
182 | - header('Location: .?name='.urlencode($name)); |
|
181 | + header('Location: .?name='.urlencode($name)); |
|
183 | 182 | } |
184 | 183 | |
185 | 184 | private function displayNotificationMessage(array $appliedPatchArray, array $skippedPatchArray) |
186 | - { |
|
187 | - $nbPatchesApplied = array_sum($appliedPatchArray); |
|
188 | - $nbPatchesSkipped = array_sum($skippedPatchArray); |
|
189 | - $msg = ''; |
|
190 | - if ($nbPatchesApplied !== 0) { |
|
191 | - $patchArr = []; |
|
192 | - foreach ($appliedPatchArray as $name => $number) { |
|
193 | - $name = $name ?: 'default'; |
|
194 | - $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
|
195 | - } |
|
196 | - |
|
197 | - $msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr)); |
|
198 | - } |
|
199 | - if ($nbPatchesSkipped !== 0) { |
|
200 | - $patchArr = []; |
|
201 | - foreach ($skippedPatchArray as $name => $number) { |
|
202 | - $name = $name ?: 'default'; |
|
203 | - $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
|
204 | - } |
|
205 | - |
|
206 | - $msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
207 | - } |
|
208 | - |
|
209 | - if ($msg !== '') { |
|
210 | - set_user_message($msg, UserMessageInterface::SUCCESS); |
|
211 | - } |
|
212 | - } |
|
185 | + { |
|
186 | + $nbPatchesApplied = array_sum($appliedPatchArray); |
|
187 | + $nbPatchesSkipped = array_sum($skippedPatchArray); |
|
188 | + $msg = ''; |
|
189 | + if ($nbPatchesApplied !== 0) { |
|
190 | + $patchArr = []; |
|
191 | + foreach ($appliedPatchArray as $name => $number) { |
|
192 | + $name = $name ?: 'default'; |
|
193 | + $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
|
194 | + } |
|
195 | + |
|
196 | + $msg .= sprintf('%d patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr)); |
|
197 | + } |
|
198 | + if ($nbPatchesSkipped !== 0) { |
|
199 | + $patchArr = []; |
|
200 | + foreach ($skippedPatchArray as $name => $number) { |
|
201 | + $name = $name ?: 'default'; |
|
202 | + $patchArr[] = plainstring_to_htmlprotected($name).': '.$number; |
|
203 | + } |
|
204 | + |
|
205 | + $msg .= sprintf('%d patch%s skipped (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
206 | + } |
|
207 | + |
|
208 | + if ($msg !== '') { |
|
209 | + set_user_message($msg, UserMessageInterface::SUCCESS); |
|
210 | + } |
|
211 | + } |
|
213 | 212 | } |
214 | 213 | \ No newline at end of file |
@@ -17,32 +17,32 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected function configure() |
|
24 | - { |
|
25 | - $this |
|
26 | - ->setName('patches:apply-all') |
|
27 | - ->setDescription('Apply pending patches.') |
|
28 | - ->setDefinition(array( |
|
29 | - |
|
30 | - )) |
|
31 | - ->setHelp(<<<EOT |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected function configure() |
|
24 | + { |
|
25 | + $this |
|
26 | + ->setName('patches:apply-all') |
|
27 | + ->setDescription('Apply pending patches.') |
|
28 | + ->setDefinition(array( |
|
29 | + |
|
30 | + )) |
|
31 | + ->setHelp(<<<EOT |
|
32 | 32 | Apply pending patches. You can select the type of patches to be applied using the options. Default patches are always applied. |
33 | 33 | |
34 | 34 | Use patches:apply if you want to cherry-pick a particular patch. |
35 | 35 | EOT |
36 | - ); |
|
37 | - |
|
38 | - $this->registerOptions(); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * {@inheritdoc} |
|
43 | - */ |
|
44 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
45 | - { |
|
46 | - $this->applyAll($input, $output); |
|
47 | - } |
|
36 | + ); |
|
37 | + |
|
38 | + $this->registerOptions(); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * {@inheritdoc} |
|
43 | + */ |
|
44 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
45 | + { |
|
46 | + $this->applyAll($input, $output); |
|
47 | + } |
|
48 | 48 | } |
@@ -12,81 +12,81 @@ |
||
12 | 12 | |
13 | 13 | class AbstractApplyAllCommand extends Command |
14 | 14 | { |
15 | - /** |
|
16 | - * @var PatchService |
|
17 | - */ |
|
18 | - protected $patchService; |
|
19 | - |
|
20 | - public function __construct(PatchService $patchService) |
|
21 | - { |
|
22 | - $this->patchService = $patchService; |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - protected function registerOptions(): void |
|
27 | - { |
|
28 | - foreach ($this->patchService->getTypes() as $type) { |
|
29 | - if ($type->getName() !== '') { |
|
30 | - $this->addOption($type->getName(), null, InputOption::VALUE_NONE, 'Applies patches of type "'.$type->getName().'". '.$type->getDescription()); |
|
31 | - } |
|
32 | - } |
|
33 | - } |
|
34 | - |
|
35 | - protected function applyAll(InputInterface $input, OutputInterface $output) |
|
36 | - { |
|
37 | - $types = []; |
|
38 | - foreach ($this->patchService->getTypes() as $type) { |
|
39 | - if ($type->getName() !== '' && $input->getOption($type->getName())) { |
|
40 | - $types[] = $type->getName(); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - try { |
|
45 | - |
|
46 | - [ |
|
47 | - 'applied' => $appliedPatchArray, |
|
48 | - 'skipped' => $skippedPatchArray |
|
49 | - ] = $this->patchService->applyAll($types); |
|
50 | - |
|
51 | - } catch (\Exception $e) { |
|
52 | - $output->writeln(sprintf( |
|
53 | - 'An error occurred while applying patch: <error>%s</error>', $e->getMessage() |
|
54 | - )); |
|
55 | - throw $e; |
|
56 | - } |
|
57 | - |
|
58 | - $msg = $this->getNotificationMessage($appliedPatchArray, $skippedPatchArray); |
|
59 | - if ($msg) { |
|
60 | - $output->writeln($msg); |
|
61 | - } else { |
|
62 | - $output->writeln('<info>No patches to apply</info>'); |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - private function getNotificationMessage(array $appliedPatchArray, array $skippedPatchArray): string |
|
67 | - { |
|
68 | - $nbPatchesApplied = array_sum($appliedPatchArray); |
|
69 | - $nbPatchesSkipped = array_sum($skippedPatchArray); |
|
70 | - $msg = ''; |
|
71 | - if ($nbPatchesApplied !== 0) { |
|
72 | - $patchArr = []; |
|
73 | - foreach ($appliedPatchArray as $name => $number) { |
|
74 | - $name = $name ?: 'default'; |
|
75 | - $patchArr[] = $name.': <info>'.$number.'</info>'; |
|
76 | - } |
|
77 | - |
|
78 | - $msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr))."\n"; |
|
79 | - } |
|
80 | - if ($nbPatchesSkipped !== 0) { |
|
81 | - $patchArr = []; |
|
82 | - foreach ($skippedPatchArray as $name => $number) { |
|
83 | - $name = $name ?: 'default'; |
|
84 | - $patchArr[] = $name.': <info>'.$number.'</info>'; |
|
85 | - } |
|
86 | - |
|
87 | - $msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
88 | - } |
|
89 | - |
|
90 | - return $msg; |
|
91 | - } |
|
15 | + /** |
|
16 | + * @var PatchService |
|
17 | + */ |
|
18 | + protected $patchService; |
|
19 | + |
|
20 | + public function __construct(PatchService $patchService) |
|
21 | + { |
|
22 | + $this->patchService = $patchService; |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + protected function registerOptions(): void |
|
27 | + { |
|
28 | + foreach ($this->patchService->getTypes() as $type) { |
|
29 | + if ($type->getName() !== '') { |
|
30 | + $this->addOption($type->getName(), null, InputOption::VALUE_NONE, 'Applies patches of type "'.$type->getName().'". '.$type->getDescription()); |
|
31 | + } |
|
32 | + } |
|
33 | + } |
|
34 | + |
|
35 | + protected function applyAll(InputInterface $input, OutputInterface $output) |
|
36 | + { |
|
37 | + $types = []; |
|
38 | + foreach ($this->patchService->getTypes() as $type) { |
|
39 | + if ($type->getName() !== '' && $input->getOption($type->getName())) { |
|
40 | + $types[] = $type->getName(); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + try { |
|
45 | + |
|
46 | + [ |
|
47 | + 'applied' => $appliedPatchArray, |
|
48 | + 'skipped' => $skippedPatchArray |
|
49 | + ] = $this->patchService->applyAll($types); |
|
50 | + |
|
51 | + } catch (\Exception $e) { |
|
52 | + $output->writeln(sprintf( |
|
53 | + 'An error occurred while applying patch: <error>%s</error>', $e->getMessage() |
|
54 | + )); |
|
55 | + throw $e; |
|
56 | + } |
|
57 | + |
|
58 | + $msg = $this->getNotificationMessage($appliedPatchArray, $skippedPatchArray); |
|
59 | + if ($msg) { |
|
60 | + $output->writeln($msg); |
|
61 | + } else { |
|
62 | + $output->writeln('<info>No patches to apply</info>'); |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + private function getNotificationMessage(array $appliedPatchArray, array $skippedPatchArray): string |
|
67 | + { |
|
68 | + $nbPatchesApplied = array_sum($appliedPatchArray); |
|
69 | + $nbPatchesSkipped = array_sum($skippedPatchArray); |
|
70 | + $msg = ''; |
|
71 | + if ($nbPatchesApplied !== 0) { |
|
72 | + $patchArr = []; |
|
73 | + foreach ($appliedPatchArray as $name => $number) { |
|
74 | + $name = $name ?: 'default'; |
|
75 | + $patchArr[] = $name.': <info>'.$number.'</info>'; |
|
76 | + } |
|
77 | + |
|
78 | + $msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr))."\n"; |
|
79 | + } |
|
80 | + if ($nbPatchesSkipped !== 0) { |
|
81 | + $patchArr = []; |
|
82 | + foreach ($skippedPatchArray as $name => $number) { |
|
83 | + $name = $name ?: 'default'; |
|
84 | + $patchArr[] = $name.': <info>'.$number.'</info>'; |
|
85 | + } |
|
86 | + |
|
87 | + $msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
88 | + } |
|
89 | + |
|
90 | + return $msg; |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $patchArr[] = $name.': <info>'.$number.'</info>'; |
76 | 76 | } |
77 | 77 | |
78 | - $msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1)?'es':'', implode(', ', $patchArr))."\n"; |
|
78 | + $msg .= sprintf('<info>%d</info> patch%s applied (%s)', $nbPatchesApplied, ($nbPatchesApplied > 1) ? 'es' : '', implode(', ', $patchArr))."\n"; |
|
79 | 79 | } |
80 | 80 | if ($nbPatchesSkipped !== 0) { |
81 | 81 | $patchArr = []; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $patchArr[] = $name.': <info>'.$number.'</info>'; |
85 | 85 | } |
86 | 86 | |
87 | - $msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1)?'es':'', implode(', ', $patchArr)); |
|
87 | + $msg .= sprintf('<info>%d</info><comment> patch%s skipped</comment> (%s)', $nbPatchesSkipped, ($nbPatchesSkipped > 1) ? 'es' : '', implode(', ', $patchArr)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $msg; |
@@ -15,34 +15,34 @@ |
||
15 | 15 | */ |
16 | 16 | class ResetPatchesCommand extends AbstractApplyAllCommand |
17 | 17 | { |
18 | - /** |
|
19 | - * {@inheritdoc} |
|
20 | - */ |
|
21 | - protected function configure() |
|
22 | - { |
|
23 | - $this |
|
24 | - ->setName('patches:reset') |
|
25 | - ->setDescription('Reset database and reapply all patches.') |
|
26 | - ->setDefinition(array( |
|
18 | + /** |
|
19 | + * {@inheritdoc} |
|
20 | + */ |
|
21 | + protected function configure() |
|
22 | + { |
|
23 | + $this |
|
24 | + ->setName('patches:reset') |
|
25 | + ->setDescription('Reset database and reapply all patches.') |
|
26 | + ->setDefinition(array( |
|
27 | 27 | |
28 | - )) |
|
29 | - ->setHelp(<<<EOT |
|
28 | + )) |
|
29 | + ->setHelp(<<<EOT |
|
30 | 30 | 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. |
31 | 31 | |
32 | 32 | Use patches:apply-all if you want to apply remaining patches without resetting the database. |
33 | 33 | EOT |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | - $this->registerOptions(); |
|
37 | - } |
|
36 | + $this->registerOptions(); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritdoc} |
|
41 | - */ |
|
42 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
43 | - { |
|
44 | - $this->patchService->reset(); |
|
39 | + /** |
|
40 | + * {@inheritdoc} |
|
41 | + */ |
|
42 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
43 | + { |
|
44 | + $this->patchService->reset(); |
|
45 | 45 | |
46 | - $this->applyAll($input, $output); |
|
47 | - } |
|
46 | + $this->applyAll($input, $output); |
|
47 | + } |
|
48 | 48 | } |