[FEATURE] Mark wizards as "done" in Install Tool 68/53468/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 13 Jul 2017 21:27:36 +0000 (23:27 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 20 Jul 2017 17:22:59 +0000 (19:22 +0200)
It is now possible to mark an upgrade wizard as "done" in the Install Tool
to prevent showing it up as an available wizard.

Resolves: #81863
Releases: master
Change-Id: I516abce3f062f330c5e56fb3a596e4f84ba7230c
Reviewed-on: https://review.typo3.org/53468
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wolfgang Klinger <wolfgang@wazum.com>
Tested-by: Wolfgang Klinger <wolfgang@wazum.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Feature-81863-MarkWizardsAsDoneInInstallTool.rst [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
typo3/sysext/install/Resources/Private/Partials/Action/Common/MarkExtensionAsDone.html [new file with mode: 0644]
typo3/sysext/install/Resources/Private/Partials/Action/Tool/UpgradeWizard/ListUpdates.html

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-81863-MarkWizardsAsDoneInInstallTool.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-81863-MarkWizardsAsDoneInInstallTool.rst
new file mode 100644 (file)
index 0000000..6f8e897
--- /dev/null
@@ -0,0 +1,20 @@
+.. include:: ../../Includes.txt
+
+======================================================
+Feature: #81863 - Mark wizards as done in Install Tool
+======================================================
+
+See :issue:`81863`
+
+Description
+===========
+
+It is now possible to mark an upgrade wizard as "done" in the Install Tool to prevent showing it up as an available wizard.
+
+
+Impact
+======
+
+A new button "Mark as done" has been added. After clicking the button, the selected upgrade wizard gets marked as "done" and will show up in the "Wizards marked as done" section.
+
+.. index:: Backend
index dbf4bfb..f617fef 100644 (file)
@@ -26,6 +26,7 @@ use TYPO3\CMS\Install\Status\ErrorStatus;
 use TYPO3\CMS\Install\Status\NoticeStatus;
 use TYPO3\CMS\Install\Status\OkStatus;
 use TYPO3\CMS\Install\Status\StatusInterface;
+use TYPO3\CMS\Install\Status\WarningStatus;
 use TYPO3\CMS\Install\Updates\AbstractUpdate;
 use TYPO3\CMS\Install\Updates\RowUpdater\RowUpdaterInterface;
 
@@ -90,8 +91,12 @@ class UpgradeWizard extends Action\AbstractAction
 
         // Perform silent cache framework table upgrade
         $this->silentCacheFrameworkTableSchemaMigration();
+        if (isset($this->postValues['set']['markAsDone'])) {
+            $actionMessages[] = $this->markWizardAsDone();
 
-        if (isset($this->postValues['set']['getUserInput'])) {
+            $this->listUpdates();
+            $this->view->assign('updateAction', 'listUpdates');
+        } elseif (isset($this->postValues['set']['getUserInput'])) {
             $actionMessages[] = $this->getUserInputForUpdate();
             $this->view->assign('updateAction', 'getUserInput');
         } elseif (isset($this->postValues['set']['performUpdate'])) {
@@ -101,7 +106,7 @@ class UpgradeWizard extends Action\AbstractAction
             $actionMessages[] = $this->recheckWizardsAndRowUpdaters();
             if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])) {
                 /** @var $message StatusInterface */
-                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
+                $message = GeneralUtility::makeInstance(WarningStatus::class);
                 $message->setTitle('No update wizards registered');
                 $actionMessages[] = $message;
             }
@@ -110,7 +115,7 @@ class UpgradeWizard extends Action\AbstractAction
         } else {
             if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])) {
                 /** @var $message StatusInterface */
-                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
+                $message = GeneralUtility::makeInstance(WarningStatus::class);
                 $message->setTitle('No update wizards registered');
                 $actionMessages[] = $message;
             }
@@ -236,6 +241,28 @@ class UpgradeWizard extends Action\AbstractAction
     }
 
     /**
+     * Marks a wizard as being "seen" so that it is not shown again.
+     *
+     * @return StatusInterface
+     * @throws \InvalidArgumentException
+     */
+    protected function markWizardAsDone()
+    {
+        $wizardIdentifier = $this->postValues['values']['identifier'];
+        $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$wizardIdentifier] ?? null;
+        if ($className === null) {
+            throw new \InvalidArgumentException('No class name found for upgrade wizard "' . $wizardIdentifier . '"', 1499980374);
+        }
+
+        GeneralUtility::makeInstance(Registry::class)->set('installUpdate', $className, '1');
+
+        $wizardTitle = GeneralUtility::makeInstance($className)->getTitle();
+        $message = GeneralUtility::makeInstance(OkStatus::class);
+        $message->setTitle('Successfully marked "' . $wizardTitle . '" as done');
+        return $message;
+    }
+
+    /**
      * Rechecks the chosen wizards and row updaters to mark them as "was not executed" again.
      *
      * @return StatusInterface
diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Common/MarkExtensionAsDone.html b/typo3/sysext/install/Resources/Private/Partials/Action/Common/MarkExtensionAsDone.html
new file mode 100644 (file)
index 0000000..bdb21a9
--- /dev/null
@@ -0,0 +1,2 @@
+<button class="btn btn-default" type="submit">{text}</button>
+<input type="hidden" name="install[set][{name}]" value="submit" />
\ No newline at end of file
index 56668df..7a20b04 100644 (file)
                                                        partial="Action/Common/SubmitButton"
                                                        arguments="{name:'getUserInput', text:'Execute', className: 'btn-primary'}"
                                                />
+                                               <f:render
+                                                       partial="Action/Common/MarkExtensionAsDone"
+                                                       arguments="{name:'markAsDone', text:'Mark as done'}"
+                                               />
                                        </div>
                                </f:if>
                                <hr />