[BUGFIX] Import/Export: Removed calls to deprecated method render() 63/45863/2
authorMichael Oehlhof <typo3@oehlhof.de>
Mon, 4 Jan 2016 00:44:15 +0000 (01:44 +0100)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Wed, 13 Jan 2016 09:33:28 +0000 (10:33 +0100)
Calls of FlashMessage->render() are replaced with appropriate code.

Resolves: #72516
Releases: master, 7.6
Change-Id: I095247810140e16c9f7b8c4fcd781d5a1ef630c4
Reviewed-on: https://review.typo3.org/45863
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/impexp/Classes/Task/ImportExportTask.php

index 4211179..88515f6 100644 (file)
@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Resource\DuplicationBehavior;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter;
@@ -496,7 +497,7 @@ class ImportExportController extends BaseScriptClass
                     /** @var FlashMessage $flashMessage */
                     $flashMessage = GeneralUtility::makeInstance(
                         FlashMessage::class,
-                        sprintf($lang->getLL('exportdata_savedInSBytes', true), $file->getPublicUrl(), GeneralUtility::formatSize(strlen($out))),
+                        sprintf($lang->getLL('exportdata_savedInSBytes'), $file->getPublicUrl(), GeneralUtility::formatSize(strlen($out))),
                         $lang->getLL('exportdata_savedFile'),
                         FlashMessage::OK
                     );
@@ -504,12 +505,16 @@ class ImportExportController extends BaseScriptClass
                     /** @var FlashMessage $flashMessage */
                     $flashMessage = GeneralUtility::makeInstance(
                         FlashMessage::class,
-                        sprintf($lang->getLL('exportdata_badPathS', true), $saveFolder->getPublicUrl()),
+                        sprintf($lang->getLL('exportdata_badPathS'), $saveFolder->getPublicUrl()),
                         $lang->getLL('exportdata_problemsSavingFile'),
                         FlashMessage::ERROR
                     );
                 }
-                $this->content .= $flashMessage->render();
+                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+                $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+                $defaultFlashMessageQueue->enqueue($flashMessage);
             }
         }
         // OUTPUT to BROWSER:
@@ -620,7 +625,7 @@ class ImportExportController extends BaseScriptClass
         );
         // Warning about hitting limit:
         if ($db->sql_num_rows($res) == $limit) {
-            $limitWarning = sprintf($this->lang->getLL('makeconfig_anSqlQueryReturned', true), $limit);
+            $limitWarning = sprintf($this->lang->getLL('makeconfig_anSqlQueryReturned'), $limit);
             /** @var FlashMessage $flashMessage */
             $flashMessage = GeneralUtility::makeInstance(
                 FlashMessage::class,
@@ -628,7 +633,11 @@ class ImportExportController extends BaseScriptClass
                 $limitWarning,
                 FlashMessage::WARNING
             );
-            $this->content .= $flashMessage->render();
+            /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+            $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+            /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+            $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+            $defaultFlashMessageQueue->enqueue($flashMessage);
         }
         return $res;
     }
@@ -1409,7 +1418,11 @@ class ImportExportController extends BaseScriptClass
                 $msg,
                 $err ? FlashMessage::ERROR : FlashMessage::INFO
             );
-            $this->content .= $flashMessage->render();
+            /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+            $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+            /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+            $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+            $defaultFlashMessageQueue->enqueue($flashMessage);
         }
     }
 
index b042934..93bae8a 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Impexp\Task;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Taskcenter\Controller\TaskModuleController;
@@ -93,7 +94,7 @@ class ImportExportTask implements TaskInterface
             // Create preset links:
             $presets = $this->getPresets();
             // If any presets found
-            if (is_array($presets)) {
+            if (is_array($presets) && !empty($presets)) {
                 $lines = [];
                 foreach ($presets as $key => $presetCfg) {
                     $configuration = unserialize($presetCfg['preset_data']);
@@ -149,10 +150,14 @@ class ImportExportTask implements TaskInterface
                 $flashMessage = GeneralUtility::makeInstance(
                     FlashMessage::class,
                     $lang->getLL('no-presets'),
-                    '',
+                    $lang->getLL('.alttitle'),
                     FlashMessage::NOTICE
                 );
-                $content .= $flashMessage->render();
+                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+                $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+                $defaultFlashMessageQueue->enqueue($flashMessage);
             }
         }
         return $content;