[FEATURE] Enable rechecking whether an UpdateWizard should run 24/49724/7
authorTobias Adolph <mail@tobiasadolph.de>
Thu, 1 Sep 2016 15:25:18 +0000 (17:25 +0200)
committerJan Helke <typo3@helke.de>
Sat, 3 Dec 2016 16:03:44 +0000 (17:03 +0100)
UpdateWizards can now be chosen to be rechecked. If the
criteria is met they are displayed as executable - otherwise not.

Resolves: #77757
Releases: master
Change-Id: I2dcd0e62c9ab3e5fe9d498a02dd9773090b110b9
Reviewed-on: https://review.typo3.org/49724
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/core/Documentation/Changelog/master/Feature-77757-EnableRecheckingWhetherAnUpdateWizardShouldRun.rst [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
typo3/sysext/install/Resources/Private/Partials/Action/Tool/UpgradeWizard/ListUpdates.html

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-77757-EnableRecheckingWhetherAnUpdateWizardShouldRun.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-77757-EnableRecheckingWhetherAnUpdateWizardShouldRun.rst
new file mode 100644 (file)
index 0000000..360043b
--- /dev/null
@@ -0,0 +1,14 @@
+.. include:: ../../Includes.txt
+
+======================================================================
+Feature: #77757 - Enable rechecking whether an UpdateWizard should run
+======================================================================
+
+See :issue:`77757`
+
+Description
+===========
+
+It is now possible to reset the upgrade wizards marked as done. In Install Tool you will find a list of wizards that has been marked as done, additionally with a checkbox for each to reset this mark. Then the wizard will be tested again, whether it needs to be executed again.
+
+.. index:: Backend
\ No newline at end of file
index 34d6edf..06af430 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Core\Cache\DatabaseSchemaService;
 use TYPO3\CMS\Core\Database\Schema\Exception\StatementException;
 use TYPO3\CMS\Core\Database\Schema\SchemaMigrator;
 use TYPO3\CMS\Core\Database\Schema\SqlReader;
+use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\VersionNumberUtility;
 use TYPO3\CMS\Install\Controller\Action;
@@ -92,6 +93,10 @@ class UpgradeWizard extends Action\AbstractAction
         } elseif (isset($this->postValues['set']['performUpdate'])) {
             $actionMessages[] = $this->performUpdate();
             $this->view->assign('updateAction', 'performUpdate');
+        } elseif (isset($this->postValues['set']['recheckWizards'])) {
+            $actionMessages[] = $this->recheckWizards();
+            $this->listUpdates();
+            $this->view->assign('updateAction', 'listUpdates');
         } else {
             $this->listUpdates();
             $this->view->assign('updateAction', 'listUpdates');
@@ -153,7 +158,11 @@ class UpgradeWizard extends Action\AbstractAction
             /** @var AbstractUpdate $updateObject */
             $updateObject = $this->getUpdateObjectInstance($className, $identifier);
             if ($updateObject->shouldRenderWizard() !== true) {
-                $wizardsDone[] = $updateObject;
+                $doneWizard = [
+                    'identifier' => $identifier,
+                    'title'      => $updateObject->getTitle()
+                ];
+                $wizardsDone[] = $doneWizard;
             }
         }
         $this->view->assign('wizardsDone', $wizardsDone);
@@ -195,6 +204,28 @@ class UpgradeWizard extends Action\AbstractAction
     }
 
     /**
+     * Rechecks whether the chosen wizards should be executed
+     *
+     * @return \TYPO3\CMS\Install\Status\StatusInterface
+     */
+    protected function recheckWizards()
+    {
+        if (empty($this->postValues['values']['recheck'])) {
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\NoticeStatus::class);
+            $message->setTitle('No wizards selected to recheck');
+            return $message;
+        }
+        foreach ($this->postValues['values']['recheck'] as $wizardIdentifier => $value) {
+            $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$wizardIdentifier];
+            $updateObject = $this->getUpdateObjectInstance($className, $wizardIdentifier);
+            GeneralUtility::makeInstance(Registry::class)->set('installUpdate', get_class($updateObject), 0);
+        }
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message->setTitle('Successfully rechecked');
+        return $message;
+    }
+
+    /**
      * Perform update of a specific wizard
      *
      * @throws \TYPO3\CMS\Install\Exception
index 8e2d7b9..27ead4d 100644 (file)
 </f:if>
 
 <f:if condition="{wizardsDone}">
-       <h2>Wizards done</h2>
-       <ul>
-               <f:for each="{wizardsDone}" as="wizardDone">
-                       <li>{wizardDone.title}</li>
-               </f:for>
-       </ul>
+       <form method="post">
+               <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" />
+               <h2>Wizards done</h2>
+               <table class="table table-striped">
+                       <tbody>
+                       <f:for each="{wizardsDone}" as="wizardDone">
+                               <tr>
+                                       <td>
+                                               <input id="t3-recheck-{wizardDone.identifier}" type="checkbox" name="install[values][recheck][{wizardDone.identifier}]" value="1" />
+                                       </td>
+                                       <td>
+                                               {wizardDone.title}
+                                       </td>
+                               </tr>
+                       </f:for>
+                       </tbody>
+               </table>
+               <f:render
+                       partial="Action/Common/SubmitButton"
+                       arguments="{name:'recheckWizards', text:'Recheck chosen wizards'}"
+               />
+       </form>
 </f:if>
 <hr />