[TASK] Install Tool: Optimize class structure 65/24665/11
authorMarkus Klein <klein.t3@mfc-linz.at>
Sat, 12 Oct 2013 11:15:14 +0000 (13:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 4 Mar 2014 20:13:04 +0000 (21:13 +0100)
Refine the class and interface structure of
Install Tool actions.

Resolves: #52736
Releases: 6.2
Change-Id: Id1b0107670859e140169767233ba9944822e0d8d
Reviewed-on: https://review.typo3.org/24665
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
40 files changed:
typo3/sysext/install/Classes/Controller/AbstractController.php
typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
typo3/sysext/install/Classes/Controller/Action/ActionInterface.php
typo3/sysext/install/Classes/Controller/Action/Ajax/AbstractAjaxAction.php [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/Action/Ajax/AbstractCoreUpdate.php
typo3/sysext/install/Classes/Controller/Action/Ajax/ClearCache.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateActivate.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateCheckPreConditions.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateDownload.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateIsUpdateAvailable.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateMove.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateUnpack.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateUpdateVersionMatrix.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateVerifyChecksum.php
typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php
typo3/sysext/install/Classes/Controller/Action/Ajax/UninstallExtension.php
typo3/sysext/install/Classes/Controller/Action/Common/InstallToolDisabledAction.php
typo3/sysext/install/Classes/Controller/Action/Common/InstallToolPasswordNotSetAction.php
typo3/sysext/install/Classes/Controller/Action/Common/LoginForm.php
typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php
typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php
typo3/sysext/install/Classes/Controller/Action/Step/StepInterface.php
typo3/sysext/install/Classes/Controller/Action/Tool/AllConfiguration.php
typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php
typo3/sysext/install/Classes/Controller/Action/Tool/FolderStructure.php
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/Controller/Action/Tool/LoadExtensions.php
typo3/sysext/install/Classes/Controller/Action/Tool/SystemEnvironment.php
typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
typo3/sysext/install/Classes/Controller/Action/Tool/Welcome.php
typo3/sysext/install/Classes/Controller/AjaxController.php
typo3/sysext/install/Classes/Controller/StepController.php
typo3/sysext/install/Classes/Controller/ToolController.php
typo3/sysext/install/Tests/Unit/Controller/Action/Ajax/ExtensionCompatibilityTesterTest.php

index 0346680..186e79f 100644 (file)
@@ -29,7 +29,7 @@ namespace TYPO3\CMS\Install\Controller;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
- * Controller abstract for shared parts of Tool and Step controller
+ * Controller abstract for shared parts of Tool, Step and Ajax controller
  */
 class AbstractController {
 
index ad0eb8a..d6fabfd 100644 (file)
@@ -29,7 +29,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * General purpose controller action helper methods and bootstrap
  */
-abstract class AbstractAction {
+abstract class AbstractAction implements ActionInterface {
 
        /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManager
@@ -74,6 +74,16 @@ abstract class AbstractAction {
        protected $messages = array();
 
        /**
+        * Handles the action
+        *
+        * @return string Rendered content
+        */
+       public function handle() {
+               $this->initializeHandle();
+               return $this->executeAction();
+       }
+
+       /**
         * Initialize the handle action, sets up fluid stuff and assigns default variables.
         *
         * @return string content
@@ -117,6 +127,13 @@ abstract class AbstractAction {
        }
 
        /**
+        * Executes the action
+        *
+        * @return string|array Rendered content
+        */
+       abstract protected function executeAction();
+
+       /**
         * Set form protection token
         *
         * @param string $token Form protection token
index f6dd66c..414068f 100644 (file)
@@ -32,7 +32,7 @@ interface ActionInterface {
        /**
         * Handle this action
         *
-        * @return string rendered content
+        * @return string Rendered content
         */
        public function handle();
 
diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/AbstractAjaxAction.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/AbstractAjaxAction.php
new file mode 100644 (file)
index 0000000..877d558
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+namespace TYPO3\CMS\Install\Controller\Action\Ajax;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Markus Klein <klein.t3@mfc-linz.at>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * General purpose AJAX controller action helper methods and bootstrap
+ */
+abstract class AbstractAjaxAction extends \TYPO3\CMS\Install\Controller\Action\AbstractAction {
+
+       /**
+        * Handles the action
+        *
+        * @return string Rendered content
+        */
+       public function handle() {
+               $this->initializeHandle();
+               return json_encode($this->executeAction());
+       }
+
+}
index 5056d8b..60d456e 100644 (file)
@@ -24,13 +24,11 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Abstract core update class contains general core update
  * related methods
  */
-abstract class AbstractCoreUpdate extends Action\AbstractAction {
+abstract class AbstractCoreUpdate extends AbstractAjaxAction {
 
        /**
         * @var \TYPO3\CMS\Install\View\JsonView
@@ -60,6 +58,7 @@ abstract class AbstractCoreUpdate extends Action\AbstractAction {
         * Common stuff to be done before performing update tasks
         *
         * @return void
+        * @throws \TYPO3\CMS\Install\Controller\Exception
         */
        protected function initializeCoreUpdate() {
                if (!$this->coreUpdateService->isCoreUpdateEnabled()) {
index 3372bdd..7bae461 100644 (file)
@@ -24,9 +24,6 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-use TYPO3\CMS\Core\Utility;
-
 /**
  * Clear Cache
  *
@@ -35,24 +32,14 @@ use TYPO3\CMS\Core\Utility;
  *
  * @see \TYPO3\CMS\Install\Service\ClearCacheService
  */
-class ClearCache extends Action\AbstractAction implements Action\ActionInterface {
-
-       /**
-        * Handle this action
-        *
-        * @return string content
-        */
-       public function handle() {
-               $this->initializeHandle();
-               return $this->clearCache();
-       }
+class ClearCache extends AbstractAjaxAction {
 
        /**
-        * Wraps the cache service
+        * Executes the action
         *
-        * @return string
+        * @return string Rendered content
         */
-       protected function clearCache() {
+       protected function executeAction() {
                /** @var \TYPO3\CMS\Install\Service\ClearCacheService $clearCacheService */
                $clearCacheService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\ClearCacheService');
                $clearCacheService->clearAll();
index 7b59074..50b8873 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Activate a downloaded core
  */
-class CoreUpdateActivate extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateActivate extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->activateVersion($this->getVersionToHandle()),
                                'status' => $this->coreUpdateService->getMessages(),
index 9fb1723..9f65747 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Activate a downloaded core
  */
-class CoreUpdateCheckPreConditions extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateCheckPreConditions extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->checkPreConditions(),
                                'status' => $this->coreUpdateService->getMessages(),
index b417f1f..24641f5 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Download latest core version
  */
-class CoreUpdateDownload extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateDownload extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->downloadVersion($this->getVersionToHandle()),
                                'status' => $this->coreUpdateService->getMessages(),
index 25fb686..95dbf37 100644 (file)
@@ -24,18 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Check if a younger version is available
  */
-class CoreUpdateIsUpdateAvailable extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateIsUpdateAvailable extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
+       protected function executeAction() {
                $this->initializeCoreUpdate();
 
                $status = array();
index e9e41bd..aa0f0de 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Move a downloaded core
  */
-class CoreUpdateMove extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateMove extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->moveVersion($this->getVersionToHandle()),
                                'status' => $this->coreUpdateService->getMessages(),
index ceed025..f46e5b7 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Unpack a downloaded core
  */
-class CoreUpdateUnpack extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateUnpack extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->unpackVersion($this->getVersionToHandle()),
                                'status' => $this->coreUpdateService->getMessages(),
index 159d497..9ca0853 100644 (file)
@@ -24,19 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Update version matrix from get.typo3.org
  */
-class CoreUpdateUpdateVersionMatrix extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateUpdateVersionMatrix extends AbstractCoreUpdate {
+
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(array(
                                'success' => $this->coreUpdateService->updateVersionMatrix(),
                                'status' => $this->coreUpdateService->getMessages(),
index 63f839a..c8c8390 100644 (file)
@@ -24,20 +24,17 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Verify checksum of a downloaded core
  */
-class CoreUpdateVerifyChecksum extends AbstractCoreUpdate implements Action\ActionInterface {
+class CoreUpdateVerifyChecksum extends AbstractCoreUpdate {
 
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return array Rendered content
         */
-       public function handle() {
-               $this->initializeCoreUpdate();
+       protected function executeAction() {
                $this->view->assignMultiple(
                        array(
                                'success' => $this->coreUpdateService->verifyFileChecksum($this->getVersionToHandle()),
index 95b141c..91461c4 100644 (file)
@@ -24,7 +24,6 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
 use TYPO3\CMS\Core\Utility;
 
 /**
@@ -35,7 +34,7 @@ use TYPO3\CMS\Core\Utility;
  * the fatal and initiates another run that will leave out the fataling extension
  * to check the rest.
  */
-class ExtensionCompatibilityTester extends Action\AbstractAction implements Action\ActionInterface {
+class ExtensionCompatibilityTester extends AbstractAjaxAction {
 
        /**
         * Store extension loading protocol
@@ -53,23 +52,13 @@ class ExtensionCompatibilityTester extends Action\AbstractAction implements Acti
        }
 
        /**
-        * Handle this action
-        *
-        * @return string content
-        */
-       public function handle() {
-               $this->initializeHandle();
-               return $this->checkLoadedExtensions();
-       }
-
-       /**
         * Main entry point for checking extensions to load,
         * setting up the checks (deleting protocol), and returning
         * OK if process run through without errors
         *
-        * @return string
+        * @return string "OK" if process ran through without errors
         */
-       protected function checkLoadedExtensions() {
+       protected function executeAction() {
                $getVars = Utility\GeneralUtility::_GET('install');
                if (isset($getVars['extensionCompatibilityTester']) && isset($getVars['extensionCompatibilityTester']['forceCheck']) && ($getVars['extensionCompatibilityTester']['forceCheck'] == 1)) {
                        $this->deleteProtocolFile();
index b8314b4..10088f2 100644 (file)
@@ -24,7 +24,6 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
 use TYPO3\CMS\Core\Utility;
 
 /**
@@ -39,26 +38,16 @@ use TYPO3\CMS\Core\Utility;
  * to take care of changed cache configurations due to no longer installed extensions.
  * Use the clearCache ajax action afterwards.
  */
-class UninstallExtension extends Action\AbstractAction implements Action\ActionInterface {
-
-       /**
-        * Handle this action
-        *
-        * @return string content
-        */
-       public function handle() {
-               $this->initializeHandle();
-               return $this->uninstallExtensions();
-       }
+class UninstallExtension extends AbstractAjaxAction {
 
        /**
         * Uninstall one or multiple extensions
         * Extension keys are read from get vars, more than one extension has to be comma separated
         * Cache is cleared "hard" after uninstalling
         *
-        * @return string
+        * @return string "OK"
         */
-       public function uninstallExtensions() {
+       protected function executeAction() {
                $getVars = Utility\GeneralUtility::_GET('install');
                if (isset($getVars['uninstallExtension']) && isset($getVars['uninstallExtension']['extensions'])) {
                        $extensionsToUninstall = Utility\GeneralUtility::trimExplode(',', $getVars['uninstallExtension']['extensions']);
index 1ff4fb9..b9d5009 100644 (file)
@@ -29,15 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Welcome page
  */
-class InstallToolDisabledAction extends Action\AbstractAction implements Action\ActionInterface {
+class InstallToolDisabledAction extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                return $this->view->render();
        }
 }
index 1b5758c..1f7d278 100644 (file)
@@ -29,15 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Welcome page
  */
-class InstallToolPasswordNotSetAction extends Action\AbstractAction implements Action\ActionInterface {
+class InstallToolPasswordNotSetAction extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                return $this->view->render();
        }
 }
index 6cf89d7..78269bc 100644 (file)
@@ -29,15 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Show login form
  */
-class LoginForm extends Action\AbstractAction implements Action\ActionInterface {
+class LoginForm extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the action
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                $this->view->assign('messages', $this->messages);
                return $this->view->render();
        }
diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php b/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php
new file mode 100644 (file)
index 0000000..e982079
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+namespace TYPO3\CMS\Install\Controller\Action\Step;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2013 Markus Klein <klein.t3@mfc-linz.at>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * General purpose Step controller action
+ */
+abstract class AbstractStepAction extends \TYPO3\CMS\Install\Controller\Action\AbstractAction implements StepInterface {
+
+}
index 43bcdef..95032f1 100644 (file)
@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 
 /**
  * Database connect step:
@@ -33,7 +33,7 @@ use TYPO3\CMS\Install\Controller\Action;
  * - Sets database credentials in LocalConfiguration
  * - Loads / unloads ext:dbal and ext:adodb if requested
  */
-class DatabaseConnect extends Action\AbstractAction implements StepInterface {
+class DatabaseConnect extends AbstractStepAction {
 
        /**
         * Execute database step:
@@ -177,12 +177,12 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
 
                                // After setting new credentials, test again and create an error message if connect is not successful
                                // @TODO: This could be simplified, if isConnectSuccessful could be released from TYPO3_CONF_VARS
-                               // and feeded with connect values directly in order to obsolete the bootstrap reload.
+                               // and fed with connect values directly in order to obsolete the bootstrap reload.
                                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
                                        ->populateLocalConfiguration()
                                        ->setCoreCacheToNullBackend();
                                if ($this->isDbalEnabled()) {
-                                       require(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('dbal') . 'ext_localconf.php');
+                                       require(ExtensionManagementUtility::extPath('dbal') . 'ext_localconf.php');
                                        $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
                                }
                                if (!$this->isConnectSuccessful()) {
@@ -219,13 +219,11 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
        }
 
        /**
-        * Render this step
+        * Executes the step
         *
-        * @return string
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                $isDbalEnabled = $this->isDbalEnabled();
                $this->view
                        ->assign('isDbalEnabled', $isDbalEnabled)
@@ -564,11 +562,11 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
         * @return \TYPO3\CMS\Install\Status\StatusInterface
         */
        protected function executeLoadDbalExtension() {
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('adodb')) {
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadExtension('adodb');
+               if (!ExtensionManagementUtility::isLoaded('adodb')) {
+                       ExtensionManagementUtility::loadExtension('adodb');
                }
-               if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dbal')) {
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadExtension('dbal');
+               if (!ExtensionManagementUtility::isLoaded('dbal')) {
+                       ExtensionManagementUtility::loadExtension('dbal');
                }
                /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
                $warningStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\WarningStatus');
@@ -582,11 +580,11 @@ class DatabaseConnect extends Action\AbstractAction implements StepInterface {
         * @return \TYPO3\CMS\Install\Status\StatusInterface
         */
        protected function executeUnloadDbalExtension() {
-               if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('adodb')) {
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::unloadExtension('adodb');
+               if (ExtensionManagementUtility::isLoaded('adodb')) {
+                       ExtensionManagementUtility::unloadExtension('adodb');
                }
-               if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dbal')) {
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::unloadExtension('dbal');
+               if (ExtensionManagementUtility::isLoaded('dbal')) {
+                       ExtensionManagementUtility::unloadExtension('dbal');
                }
                // @TODO: Remove configuration from TYPO3_CONF_VARS['EXTCONF']['dbal']
                /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
index a20eaa0..b444e18 100644 (file)
@@ -24,12 +24,10 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Populate base tables, insert admin user, set install tool password
  */
-class DatabaseData extends Action\AbstractAction implements StepInterface {
+class DatabaseData extends AbstractStepAction {
 
        /**
         * Import tables and data, create admin user, create install tool password
@@ -98,12 +96,11 @@ class DatabaseData extends Action\AbstractAction implements StepInterface {
        }
 
        /**
-        * Render this step
+        * Executes the step
         *
-        * @return string
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                return $this->view->render();
        }
 
index 26b6e34..74c32cc 100644 (file)
@@ -24,14 +24,13 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
 
 /**
  * Database select step.
  * This step is only rendered if database is mysql. With dbal,
  * database name is submitted by previous step already.
  */
-class DatabaseSelect extends Action\AbstractAction implements StepInterface {
+class DatabaseSelect extends AbstractStepAction {
 
        /**
         * @var \TYPO3\CMS\Core\Database\DatabaseConnection
@@ -122,12 +121,11 @@ class DatabaseSelect extends Action\AbstractAction implements StepInterface {
        }
 
        /**
-        * Render this step
+        * Executes the step
         *
-        * @return string
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
                $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
                $isInitialInstallationInProgress = $configurationManager->getConfigurationValueByPath('SYS/isInitialInstallationInProgress');
index d4218f5..5e48d25 100644 (file)
@@ -24,12 +24,10 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Set production defaults
  */
-class DefaultConfiguration extends Action\AbstractAction implements StepInterface {
+class DefaultConfiguration extends AbstractStepAction {
 
        /**
         * Set defaults of auto configuration, mark installation as completed
@@ -84,12 +82,11 @@ class DefaultConfiguration extends Action\AbstractAction implements StepInterfac
        }
 
        /**
-        * Render this step
+        * Executes the step
         *
-        * @return string
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                return $this->view->render();
        }
 }
index af679b8..255978c 100644 (file)
@@ -24,8 +24,6 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Install\Controller\Action;
-
 /**
  * Very first install step:
  * - Needs execution if typo3conf/LocalConfiguration.php does not exist
@@ -33,7 +31,7 @@ use TYPO3\CMS\Install\Controller\Action;
  * - Creates folders like typo3temp, see FolderStructure/DefaultFactory for details
  * - Creates typo3conf/LocalConfiguration.php from factory
  */
-class EnvironmentAndFolders extends Action\AbstractAction implements StepInterface {
+class EnvironmentAndFolders extends AbstractStepAction {
 
        /**
         * Execute environment and folder step:
@@ -95,13 +93,11 @@ class EnvironmentAndFolders extends Action\AbstractAction implements StepInterfa
        }
 
        /**
-        * Render this step
+        * Executes the step
         *
-        * @return string
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                /** @var \TYPO3\CMS\Install\SystemEnvironment\Check $statusCheck */
                $statusCheck = $this->objectManager->get('TYPO3\\CMS\\Install\\SystemEnvironment\\Check');
                $statusObjects = $statusCheck->getStatus();
index 35de348..5e0cf47 100644 (file)
@@ -29,8 +29,7 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Interface implemented by single steps
  */
-interface StepInterface extends Action\ActionInterface {
-
+interface StepInterface {
        /**
         * Execute a step
         *
index 7a85b0f..857173a 100644 (file)
@@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Show system environment check results
  */
-class AllConfiguration extends Action\AbstractAction implements Action\ActionInterface {
+class AllConfiguration extends Action\AbstractAction {
 
        /**
         * Error handlers are a bit mask in PHP. This register hints the View to
@@ -47,13 +47,11 @@ class AllConfiguration extends Action\AbstractAction implements Action\ActionInt
        );
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                if (isset($this->postValues['set']['write'])) {
                        $this->view->assign('configurationValuesSaved', TRUE);
                        $this->view->assign('savedConfigurationValueMessages', $this->updateLocalConfigurationValues());
index 650f4ed..9781263 100644 (file)
@@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Clean up page
  */
-class CleanUp extends Action\AbstractAction implements Action\ActionInterface {
+class CleanUp extends Action\AbstractAction {
 
        /**
         * Status messages of submitted actions
@@ -40,13 +40,11 @@ class CleanUp extends Action\AbstractAction implements Action\ActionInterface {
        protected $actionMessages = array();
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                if (isset($this->postValues['set']['clearTables'])) {
                        $this->actionMessages[] = $this->clearSelectedTables();
                }
index 62e0a39..ecd92a4 100644 (file)
@@ -29,7 +29,7 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Show configuration features and handle presets
  */
-class Configuration extends Action\AbstractAction implements Action\ActionInterface {
+class Configuration extends Action\AbstractAction {
 
        /**
         * @var \TYPO3\CMS\Install\Configuration\FeatureManager
@@ -44,13 +44,11 @@ class Configuration extends Action\AbstractAction implements Action\ActionInterf
        protected $configurationManager = NULL;
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                $actionMessages = array();
                if (isset($this->postValues['set']['activate'])) {
                        $actionMessages[] = $this->activate();
index 7e542a9..dc0c0c0 100644 (file)
@@ -29,16 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Handle folder structure
  */
-class FolderStructure extends Action\AbstractAction implements Action\ActionInterface {
+class FolderStructure extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
                $folderStructureFactory = $this->objectManager->get('TYPO3\\CMS\\Install\\FolderStructure\\DefaultFactory');
                /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
index 7b1ec96..dd5ceaf 100644 (file)
@@ -30,16 +30,14 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Handle important actions
  */
-class ImportantActions extends Action\AbstractAction implements Action\ActionInterface {
+class ImportantActions extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                if (isset($this->postValues['set']['changeEncryptionKey'])) {
                        $this->setNewEncryptionKeyAndLogOut();
                }
index 096b239..d6336b8 100644 (file)
@@ -29,15 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Welcome page
  */
-class LoadExtensions extends Action\AbstractAction implements Action\ActionInterface {
+class LoadExtensions extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                $extensionCompatibilityTesterFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTester.txt';
                $this->view->assign('extensionCompatibilityTesterProtocolFile', $extensionCompatibilityTesterFile);
 
index b3006b6..8900adf 100644 (file)
@@ -29,16 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Show system environment check results
  */
-class SystemEnvironment extends Action\AbstractAction implements Action\ActionInterface {
+class SystemEnvironment extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                /** @var $statusCheck \TYPO3\CMS\Install\SystemEnvironment\Check */
                $statusCheck = $this->objectManager->get('TYPO3\\CMS\\Install\\SystemEnvironment\\Check');
                $statusObjects = $statusCheck->getStatus();
index 4c26a9c..b5e109f 100644 (file)
@@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Test various system setup settings
  */
-class TestSetup extends Action\AbstractAction implements Action\ActionInterface {
+class TestSetup extends Action\AbstractAction {
 
        /**
         * @var string Absolute path to image folder
@@ -38,13 +38,11 @@ class TestSetup extends Action\AbstractAction implements Action\ActionInterface
        protected $imageBasePath = '';
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                $this->imageBasePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('install') . 'Resources/Public/Images/';
 
                $actionMessages = array();
index fe77b7f..deec18a 100644 (file)
@@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Handle update wizards
  */
-class UpgradeWizard extends Action\AbstractAction implements Action\ActionInterface {
+class UpgradeWizard extends Action\AbstractAction {
 
        /**
         * There are tables and fields missing in the database
@@ -40,13 +40,11 @@ class UpgradeWizard extends Action\AbstractAction implements Action\ActionInterf
        protected $needsInitialUpdateDatabaseSchema = FALSE;
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
-
+       protected function executeAction() {
                // ext_localconf, db and ext_tables must be loaded for the upgrade wizards
                $this->loadExtLocalconfDatabaseAndExtTables();
 
index 75878b5..ec61b68 100644 (file)
@@ -29,15 +29,14 @@ use TYPO3\CMS\Install\Controller\Action;
 /**
  * Welcome page
  */
-class Welcome extends Action\AbstractAction implements Action\ActionInterface {
+class Welcome extends Action\AbstractAction {
 
        /**
-        * Handle this action
+        * Executes the tool
         *
-        * @return string content
+        * @return string Rendered content
         */
-       public function handle() {
-               $this->initializeHandle();
+       protected function executeAction() {
                return $this->view->render();
        }
 }
index b80bc11..1fd1374 100644 (file)
@@ -151,7 +151,7 @@ class AjaxController extends AbstractController {
                $actionClass = ucfirst($action);
                /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $toolAction */
                $toolAction = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\' . $actionClass);
-               if (!($toolAction instanceof \TYPO3\CMS\Install\Controller\Action\ActionInterface)) {
+               if (!($toolAction instanceof Action\ActionInterface)) {
                        throw new Exception(
                                $action . ' does not implement ActionInterface',
                                1369474308
@@ -168,14 +168,14 @@ class AjaxController extends AbstractController {
         * Output content.
         * WARNING: This exits the script execution!
         *
-        * @param string $content Content to output
+        * @param string $content JSON encoded content to output
         */
        protected function output($content = '') {
                ob_clean();
                header('Content-Type: application/json; charset=utf-8');
                header('Cache-Control: no-cache, must-revalidate');
                header('Pragma: no-cache');
-               echo json_encode($content);
+               echo $content;
                die;
        }
 }
index ed0e321..4924fb3 100644 (file)
@@ -113,6 +113,7 @@ class StepController extends AbstractController {
                $stepAction->setToken($this->generateTokenForAction($action));
                $stepAction->setPostValues($this->getPostValues());
 
+               $needsExecution = TRUE;
                try {
                        // needsExecution() may throw a RedirectException to communicate that it changed
                        // configuration parameters and need an application reload.
@@ -370,6 +371,7 @@ class StepController extends AbstractController {
                /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */
                $action = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Step\\EnvironmentAndFolders');
 
+               $needsExecution = TRUE;
                try {
                        // needsExecution() may throw a RedirectException to communicate that it changed
                        // configuration parameters and need an application reload.
index c61f1b7..961638b 100644 (file)
@@ -186,7 +186,7 @@ class ToolController extends AbstractController {
                $actionClass = ucfirst($action);
                /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $toolAction */
                $toolAction = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Tool\\' . $actionClass);
-               if (!($toolAction instanceof \TYPO3\CMS\Install\Controller\Action\ActionInterface)) {
+               if (!($toolAction instanceof Action\ActionInterface)) {
                        throw new Exception(
                                $action . ' does not implement ActionInterface',
                                1369474309
index 73ae8bf..3a710da 100644 (file)
@@ -49,42 +49,42 @@ class ExtensionCompatibilityTesterTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
        /**
         * @test
         */
-       public function checkLoadedExtensionsReturnsStringOkIfAllIsWell() {
+       public function executeActionReturnsStringOkIfAllIsWell() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('getExtensionsToLoad', 'tryToLoadExtLocalconfAndExtTablesOfExtensions', 'deleteProtocolFile'), array());
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad')->will($this->returnValue(array()));
-               $result = $extensionCompatibilityTesterMock->_call('checkLoadedExtensions');
+               $result = $extensionCompatibilityTesterMock->_call('executeAction');
                $this->assertEquals('OK', $result);
        }
 
        /**
         * @test
         */
-       public function checkLoadedExtensionsCallsGetExtensionsToLoad() {
+       public function executeActionCallsGetExtensionsToLoad() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('getExtensionsToLoad', 'deleteProtocolFile', 'tryToLoadExtLocalconfAndExtTablesOfExtensions'), array());
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad')->will($this->returnValue(array()));
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad');
-               $extensionCompatibilityTesterMock->_call('checkLoadedExtensions');
+               $extensionCompatibilityTesterMock->_call('executeAction');
        }
 
        /**
         * @test
         */
-       public function checkLoadedExtensionsCallsLoadExtensions() {
+       public function executeActionCallsLoadExtensions() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('tryToLoadExtLocalconfAndExtTablesOfExtensions', 'getExtensionsToLoad', 'deleteProtocolFile'), array());
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad')->will($this->returnValue(array()));
                $extensionCompatibilityTesterMock->expects($this->once())->method('tryToLoadExtLocalconfAndExtTablesOfExtensions');
-               $extensionCompatibilityTesterMock->_call('checkLoadedExtensions');
+               $extensionCompatibilityTesterMock->_call('executeAction');
        }
 
        /**
         * @test
         */
-       public function checkLoadedExtensionsCallsDeleteProtocolFileIfForceCheckIsSet() {
+       public function executeActionCallsDeleteProtocolFileIfForceCheckIsSet() {
                $extensionCompatibilityTesterMock = $this->getAccessibleMock('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\ExtensionCompatibilityTester', array('tryToLoadExtLocalconfAndExtTablesOfExtensions', 'getExtensionsToLoad', 'deleteProtocolFile'), array());
                $extensionCompatibilityTesterMock->expects($this->once())->method('getExtensionsToLoad')->will($this->returnValue(array()));
                $_GET['install']['extensionCompatibilityTester']['forceCheck'] = 1;
                $extensionCompatibilityTesterMock->expects($this->once())->method('deleteProtocolFile');
-               $extensionCompatibilityTesterMock->_call('checkLoadedExtensions');
+               $extensionCompatibilityTesterMock->_call('executeAction');
                unset($_GET['install']['extensionCompatibilityTester']['forceCheck']);
        }