[BUGFIX] Show errors on distribution installation 68/31268/2
authorSascha Egerer <sascha.egerer@dkd.de>
Mon, 30 Jun 2014 09:36:00 +0000 (11:36 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Jul 2014 17:22:38 +0000 (19:22 +0200)
When you install a distribution and an error occurred, you get a fluid
error: "Sorry, the requested view was not found."

There is currently no template / view for the action. This patch renders
the error messages as flash messages and redirects to the list view of
distributions where the errors are shown.

Resolves: #59564
Resolves: #59952
Releases: 6.3, 6.2
Change-Id: Ie0e055dfd5620d4e0a08ecf87b2f458e7877ee76
Reviewed-on: https://review.typo3.org/31268
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf

index 2cb75b6..c82c07d 100644 (file)
@@ -131,12 +131,27 @@ class DownloadController extends AbstractController {
                if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('impexp')) {
                        $this->forward('distributions', 'List');
                }
-               list($result, $errorMessage) = $this->installFromTer($extension);
-               if ($errorMessage) {
-                       // @TODO: write Template
-                       $this->view
-                               ->assign('result', $result)
-                               ->assign('errorMessage', $errorMessage);
+               list($result, $errorMessages) = $this->installFromTer($extension);
+               if ($errorMessages) {
+                       foreach ($errorMessages as $extensionKey => $messages) {
+                               foreach ($messages as $message) {
+                                       $this->addFlashMessage(
+                                               $message['message'],
+                                               \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
+                                                       'distribution.error.headline',
+                                                       'extensionmanager',
+                                                       array($extensionKey)
+                                               ),
+                                               \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR
+                                       );
+                               }
+                       }
+
+                       // Redirect back to distributions list action
+                       $this->redirect(
+                               'distributions',
+                               'List'
+                       );
                } else {
                        // FlashMessage that extension is installed
                        $this->addFlashMessage(
index 67e85cc..94b0358 100644 (file)
                        <trans-unit id="extensionList.uninstall.dependencyError" xml:space="preserve">
                                <source>Cannot deactivate extension '%s' - The extension(s) '%s' depend on it.</source>
                        </trans-unit>
+                       <trans-unit id="distribution.error.headline" xml:space="preserve">
+                               <source>Could not install distribution '%s'</source>
+                       </trans-unit>
                        <trans-unit id="distribution.welcome.headline" xml:space="preserve">
                                <source>Congratulations...</source>
                        </trans-unit>