[BUGFIX] Use consistent API for checking update status
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Report / InstallStatusReport.php
index 4a5a4c6..05b0898 100644 (file)
@@ -18,7 +18,7 @@ use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Service\Exception;
-use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
+use TYPO3\CMS\Install\Service\UpgradeWizardsService;
 use TYPO3\CMS\Reports\Status;
 
 /**
@@ -152,27 +152,14 @@ class InstallStatusReport implements \TYPO3\CMS\Reports\StatusProviderInterface
         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
         // check if there are update wizards left to perform
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] ?? null)) {
-            $versionAsInt = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
-            $incompleteWizardFound = false;
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) {
-                $updateObject = GeneralUtility::makeInstance($className, $identifier, $versionAsInt, null, $this);
-                if (method_exists($updateObject, 'shouldRenderWizard') && $updateObject->shouldRenderWizard()) {
-                    $incompleteWizardFound = true;
-                    break;
-                }
-                if ($updateObject instanceof UpgradeWizardInterface && $updateObject->updateNecessary()) {
-                    $incompleteWizardFound = true;
-                    break;
-                }
-            }
-            if ($incompleteWizardFound) {
-                // At least one incomplete wizard was found
-                $value = $languageService->getLL('status_updateIncomplete');
-                $severity = Status::WARNING;
-                $url = (string)$uriBuilder->buildUriFromRoute('tools_toolsupgrade');
-                $message = sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.install_update'), '<a href="' . htmlspecialchars($url) . '">', '</a>');
-            }
+        $upgradeWizardsService = GeneralUtility::makeInstance(UpgradeWizardsService::class);
+        $incompleteWizards = $upgradeWizardsService->getUpgradeWizardsList();
+        if (count($incompleteWizards)) {
+            // At least one incomplete wizard was found
+            $value = $languageService->getLL('status_updateIncomplete');
+            $severity = Status::WARNING;
+            $url = (string)$uriBuilder->buildUriFromRoute('tools_toolsupgrade');
+            $message = sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.install_update'), '<a href="' . htmlspecialchars($url) . '">', '</a>');
         }
 
         return GeneralUtility::makeInstance(Status::class, $languageService->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_remainingUpdates'), $value, $message, $severity);