[BUGFIX] Workspaces and Version update wizard isn't skippable 80/22680/4
authorWouter Wolters <typo3@wouterwolters.nl>
Mon, 29 Jul 2013 23:42:51 +0000 (01:42 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 8 Aug 2013 20:23:17 +0000 (22:23 +0200)
When you skip the update wizard for workspaces and version
you always get the wizard back. The update wizard is not marked
as done when you don't want to install the extensions.

To fix this we need to copy some functions from AbstractUpdate
because the update wizard for workspaces and version extend the
SystemExtension update wizard.

Change-Id: I4f7f3e8606cdf41db5737b5f4dd22d8faf4a4acb
Resolves: #47734
Releases: 6.2
Reviewed-on: https://review.typo3.org/22680
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/install/Classes/Updates/MigrateWorkspacesUpdate.php

index 96307ec..f02432d 100644 (file)
@@ -51,6 +51,9 @@ class MigrateWorkspacesUpdate extends InstallSysExtsUpdate {
         * @return boolean Whether an update is needed (TRUE) or not (FALSE)
         */
        public function checkForUpdate(&$description) {
+               if ($this->isWizardDone()) {
+                       return FALSE;
+               }
                $result = FALSE;
                $description = 'Migrates the old hardcoded draft workspace to be a real workspace record,
                updates workspace owner fields to support either users or groups and
@@ -154,6 +157,7 @@ class MigrateWorkspacesUpdate extends InstallSysExtsUpdate {
                }
                // Wizard skipped by the user
                if (empty($this->pObj->INSTALL['update']['migrateWorkspaces']['versioning'])) {
+                       $this->markWizardAsDone();
                        return TRUE;
                }
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
@@ -383,6 +387,30 @@ class MigrateWorkspacesUpdate extends InstallSysExtsUpdate {
                return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_workspace', $where);
        }
 
-}
+       /**
+        * Marks some wizard as being "seen" so that it not shown again.
+        *
+        * Writes the info in LocalConfiguration.php
+        *
+        * @param mixed $confValue The configuration is set to this value
+        * @return void
+        */
+       protected function markWizardAsDone($confValue = 1) {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue);
+       }
 
+       /**
+        * Checks if this wizard has been "done" before
+        *
+        * @return boolean TRUE if wizard has been done before, FALSE otherwise
+        */
+       protected function isWizardDone() {
+               $wizardClassName = get_class($this);
+               $done = FALSE;
+               if (isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName]) && $GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone'][$wizardClassName]) {
+                       $done = TRUE;
+               }
+               return $done;
+       }
+}
 ?>
\ No newline at end of file