[BUGFIX] Use consistent API for checking update status 20/58620/3
authorSusanne Moog <susanne.moog@typo3.org>
Fri, 12 Oct 2018 09:53:24 +0000 (11:53 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 13 Oct 2018 11:38:01 +0000 (13:38 +0200)
Instead of re-implementing checking of update wizards in
the status report, the same methods for checking should be
used to generate the same status as the install tool upgrade
wizard section itself.

Resolves: #86632
Releases: master
Change-Id: Ifc0f282dcb42dd52b79e65c31e29f52b46e54593
Reviewed-on: https://review.typo3.org/58620
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
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);