[BUGFIX] Clean up message handling in install tool 79/39279/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 5 May 2015 12:52:50 +0000 (14:52 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 5 May 2015 14:02:23 +0000 (16:02 +0200)
The extension compatibility misuses the install tool message
system for its tests and hands over on-the-fly arrays instead
of proper message objects.
The patch moves the message creation to the controller and
hands them over to view instead.

Resolves: #66805
Releases: master
Change-Id: Icea9955e7e1206327f859abf4ec3bcada50a65e6
Reviewed-on: http://review.typo3.org/39279
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/Controller/Action/Tool/LoadExtensions.php
typo3/sysext/install/Classes/Status/LoadingStatus.php [new file with mode: 0644]
typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ExtensionCompatibilityTester.html

index e4cedbc..6904a71 100644 (file)
@@ -263,4 +263,29 @@ abstract class AbstractAction implements ActionInterface {
                return $saltFactory->getHashedPassword($password);
        }
 
+       /**
+        * Prepare status messages used in extension compatibility view template
+        *
+        * @return \TYPO3\CMS\Install\Status\StatusInterface[]
+        */
+       protected function getExtensionCompatibilityTesterMessages() {
+               $extensionCompatibilityTesterMessages = array();
+
+               /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
+               $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\LoadingStatus::class);
+               $message->setTitle('Loading...');
+               $extensionCompatibilityTesterMessages[] = $message;
+
+               $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+               $message->setTitle('Incompatible extension found!');
+               $message->setMessage('Something went wrong and no protocol was written.');
+               $extensionCompatibilityTesterMessages[] = $message;
+
+               $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+               $message->setTitle('All local extensions can be loaded!');
+               $extensionCompatibilityTesterMessages[] = $message;
+
+               return $extensionCompatibilityTesterMessages;
+       }
+
 }
index 37dcdbd..2c77e26 100644 (file)
@@ -81,6 +81,7 @@ class ImportantActions extends Action\AbstractAction {
                        ->assign('databaseNumberOfTables', count($this->getDatabaseConnection()->admin_get_tables()))
                        ->assign('extensionCompatibilityTesterProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTester.txt')
                        ->assign('extensionCompatibilityTesterErrorProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTesterErrors.json')
+                       ->assign('extensionCompatibilityTesterMessages', $this->getExtensionCompatibilityTesterMessages())
                        ->assign('listOfOpcodeCaches', OpcodeCacheUtility::getAllActive());
 
                return $this->view->render();
index f9120e1..dbcdfa5 100644 (file)
@@ -28,7 +28,9 @@ class LoadExtensions extends Action\AbstractAction {
         */
        protected function executeAction() {
                $extensionCompatibilityTesterFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTester.txt';
-               $this->view->assign('extensionCompatibilityTesterProtocolFile', $extensionCompatibilityTesterFile);
+               $this->view
+                       ->assign('extensionCompatibilityTesterProtocolFile', $extensionCompatibilityTesterFile)
+                       ->assign('extensionCompatibilityTesterMessages', $this->getExtensionCompatibilityTesterMessages());
 
                return $this->view->render();
        }
diff --git a/typo3/sysext/install/Classes/Status/LoadingStatus.php b/typo3/sysext/install/Classes/Status/LoadingStatus.php
new file mode 100644 (file)
index 0000000..ff220db
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+namespace TYPO3\CMS\Install\Status;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Loading level status - Used in Extension compatibility tester
+ */
+class LoadingStatus extends AbstractStatus implements StatusInterface {
+
+       /**
+        * @var string The severity
+        */
+       protected $severity = 'loading';
+
+}
index 0c59cd4..72f2338 100644 (file)
@@ -6,15 +6,9 @@
 <form method="post">
        <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" />
        <div id="checkExtensions" data-protocolurl="{extensionCompatibilityTesterProtocolFile}" data-errorprotocolurl="{extensionCompatibilityTesterErrorProtocolFile}">
-               <f:render partial="Action/Common/StatusMessage" arguments="{
-                       message: {severity:'loading', title:'', message:'Loading...'}
-               }" />
-               <f:render partial="Action/Common/StatusMessage" arguments="{
-                       message: {severity:'error', title:'Incompatible extension found!', message:'Something went wrong and no protocol was written.'}
-               }" />
-               <f:render partial="Action/Common/StatusMessage" arguments="{
-                       message: {severity:'ok', title:'All local extensions can be loaded!'}
-               }" />
+               <f:for each="{extensionCompatibilityTesterMessages}" as="statusMessage">
+                       <f:render partial="Action/Common/StatusMessage" arguments="{message: statusMessage}" />
+               </f:for>
                <f:render partial="Action/Common/SubmitButton" arguments="{name:'checkExtensions', text:'Check extensions'}"/>
        </div>
 </form>