@@ -197,15 +197,15 @@ |
||
197 | 197 | |
198 | 198 | $html = '<strong>Patcher</strong>: <a href="'.ROOT_URL.'vendor/mouf/mouf/patcher/?name='.$instanceName.'" class="btn btn-large btn-success patch-run-all"><i class="icon-arrow-right icon-white"></i> Apply '; |
199 | 199 | if ($nbAwaitingPatchs != 0) { |
200 | - $html .= $nbAwaitingPatchs." awaiting patch".(($nbAwaitingPatchs != 1)?"es":""); |
|
200 | + $html .= $nbAwaitingPatchs." awaiting patch".(($nbAwaitingPatchs != 1) ? "es" : ""); |
|
201 | 201 | if ($nbPatchesInError != 0) { |
202 | - $html .=" and"; |
|
202 | + $html .= " and"; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | if ($nbPatchesInError != 0) { |
206 | - $html .=$nbPatchesInError." patch".(($nbPatchesInError != 1)?"es":"")." in error"; |
|
206 | + $html .= $nbPatchesInError." patch".(($nbPatchesInError != 1) ? "es" : "")." in error"; |
|
207 | 207 | } |
208 | - $html .='</a>'; |
|
208 | + $html .= '</a>'; |
|
209 | 209 | |
210 | 210 | |
211 | 211 | return new MoufValidatorResult($status, $html); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Mouf\Utils\Patcher; |
5 | 5 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $patches = $this->patchService->getView(); |
55 | 55 | |
56 | 56 | $rows = array_map(function($row) { |
57 | - return [ $row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)' ]; |
|
57 | + return [$row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)']; |
|
58 | 58 | }, $patches); |
59 | 59 | |
60 | 60 | $table = new Table($output); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function getLastErrorMessage(): ?string; |
|
89 | + public function getLastErrorMessage(): ? string; |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Returns the URL that can be used to edit this patch. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function getEditUrl(): ?string; |
|
97 | + public function getEditUrl(): ? string; |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Returns the type of the patch. |
@@ -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); |
@@ -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> |
@@ -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'): ?> |
@@ -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 !== '') { |
@@ -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; |