[FEATURE] Add list of done upgrade wizards 22/47022/4
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 3 Mar 2016 19:29:24 +0000 (20:29 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 4 Mar 2016 10:24:12 +0000 (11:24 +0100)
During upgrade wizard procedure the already resolved wizards are listed
in the Upgrade Wizard View in Install Tool.

Resolves: #74063
Releases: master
Change-Id: I011e3e776e92bb1dd07f3e031a4fb26ecf5da018
Reviewed-on: https://review.typo3.org/47022
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Daniel Schmidt <daniel@netz-basis.com>
Tested-by: Daniel Schmidt <daniel@netz-basis.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
typo3/sysext/install/Resources/Private/Partials/Action/Tool/UpgradeWizard/ListUpdates.html
typo3/sysext/install/Resources/Private/Templates/Action/Tool/UpgradeWizard.html

index 5b22433..1f96ee5 100644 (file)
@@ -73,7 +73,7 @@ class UpgradeWizard extends Action\AbstractAction
             $actionMessages[] = $this->performUpdate();
             $this->view->assign('updateAction', 'performUpdate');
         } else {
-            $actionMessages[] = $this->listUpdates();
+            $this->listUpdates();
             $this->view->assign('updateAction', 'listUpdates');
         }
 
@@ -85,7 +85,7 @@ class UpgradeWizard extends Action\AbstractAction
     /**
      * List of available updates
      *
-     * @return \TYPO3\CMS\Install\Status\StatusInterface
+     * @return void
      */
     protected function listUpdates()
     {
@@ -127,10 +127,21 @@ class UpgradeWizard extends Action\AbstractAction
 
         $this->view->assign('availableUpdates', $availableUpdates);
 
-        /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
-        $message->setTitle('Show available update wizards');
-        return $message;
+        // compute done wizards for statistics
+        $wizardsDone = [];
+        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) {
+            /** @var AbstractUpdate $updateObject */
+            $updateObject = $this->getUpdateObjectInstance($className, $identifier);
+            if ($updateObject->shouldRenderWizard() !== true) {
+                $wizardsDone[] = $updateObject;
+            }
+        }
+        $this->view->assign('wizardsDone', $wizardsDone);
+
+        $wizardsTotal = (count($wizardsDone) + count($availableUpdates));
+        $this->view->assign('wizardsTotal', $wizardsTotal);
+
+        $this->view->assign('wizardsPercentageDone', floor(($wizardsTotal - count($availableUpdates)) * 100 / $wizardsTotal));
     }
 
     /**
index 098dd67..8e2d7b9 100644 (file)
@@ -5,6 +5,14 @@
 </p>
 <hr />
 
+<h2>Wizards available</h2>
+<div class="progress">
+       <div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar"
+                aria-valuenow="{wizardsPercentageDone}" aria-valuemin="0" aria-valuemax="100"
+                style="width: {wizardsPercentageDone}%;">
+               {wizardsPercentageDone}% Complete
+       </div>
+</div>
 <f:if condition="{availableUpdates}">
        <f:then>
                <f:for each="{availableUpdates}" as="availableUpdate">
        </f:else>
 </f:if>
 
+<f:if condition="{wizardsDone}">
+       <h2>Wizards done</h2>
+       <ul>
+               <f:for each="{wizardsDone}" as="wizardDone">
+                       <li>{wizardDone.title}</li>
+               </f:for>
+       </ul>
+</f:if>
+<hr />
+
 <h4>Hint</h4>
 <p>
        When all updates are done you can check the database for tables and fields no longer required.
index 96ed3bd..0c9f02e 100644 (file)
@@ -9,7 +9,6 @@
                <f:render partial="Action/Common/StatusMessage" arguments="{message: statusMessage}" />
        </f:for>
 
-
        <f:if condition="{updateAction} == 'listUpdates'">
                <f:render partial="Action/Tool/UpgradeWizard/ListUpdates" arguments="{_all}" />
        </f:if>