Skip to content

Commit c7bfc8a

Browse files
svewapclaude
andcommitted
Make HasRemainingUpdates resilient against broken upgrade wizards
A single upgrade wizard whose updateNecessary() throws used to kill the entire monitoring call. Iterate per identifier with try/catch so a defective wizard surfaces as remaining=true in Zabbix and is logged, while the operation itself stays available. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0f53757 commit c7bfc8a

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

Classes/Operation/HasRemainingUpdates.php

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* LICENSE.txt file that was distributed with this source code.
1010
*/
1111

12+
use TYPO3\CMS\Core\Log\LogManager;
1213
use TYPO3\CMS\Core\Service\UpgradeWizardsService;
1314
use TYPO3\CMS\Core\SingletonInterface;
1415
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -29,16 +30,31 @@ class HasRemainingUpdates implements IOperation, SingletonInterface
2930
*/
3031
public function execute(array $parameter = []): OperationResult
3132
{
32-
3333
$upgradeWizardsService = GeneralUtility::makeInstance(UpgradeWizardsService::class);
34-
$incompleteWizards = $upgradeWizardsService->getUpgradeWizardsList();
35-
$incompleteWizards = array_filter(
36-
$incompleteWizards,
37-
function ($wizard) {
38-
return $wizard['shouldRenderWizard'];
34+
$logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
35+
36+
$hasRemaining = false;
37+
foreach ($upgradeWizardsService->getUpgradeWizardIdentifiers() as $identifier) {
38+
try {
39+
if ($upgradeWizardsService->isWizardDone($identifier)) {
40+
continue;
41+
}
42+
$info = $upgradeWizardsService->getWizardInformationByIdentifier($identifier);
43+
if (!empty($info['shouldRenderWizard'])) {
44+
$hasRemaining = true;
45+
}
46+
} catch (\Throwable $e) {
47+
// A single broken upgrade wizard must not break the whole monitoring call.
48+
// Report remaining=true so the broken state surfaces in Zabbix.
49+
$logger->warning('Upgrade wizard "{identifier}" check failed: {message}', [
50+
'identifier' => $identifier,
51+
'message' => $e->getMessage(),
52+
'exception' => $e,
53+
]);
54+
$hasRemaining = true;
3955
}
40-
);
41-
return new OperationResult(true, count($incompleteWizards) > 0);
56+
}
57+
return new OperationResult(true, $hasRemaining);
4258
}
4359

44-
}
60+
}

0 commit comments

Comments
 (0)