[TASK] Cleanup code of LocalizationController::process 49/51349/3
authorManuel Selbach <manuel_selbach@yahoo.de>
Wed, 18 Jan 2017 20:12:16 +0000 (21:12 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 26 Jan 2017 07:57:26 +0000 (08:57 +0100)
Change-Id: I6db726bfff61c092309a971eb71e074c30cad046
Releases: master, 7.6
Resolves: #79378
Reviewed-on: https://review.typo3.org/51349
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Manuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Controller/Page/LocalizationController.php

index 66b2fb5..4270aab 100644 (file)
@@ -209,8 +209,6 @@ class LocalizationController
      */
     protected function process($params)
     {
-        $pageId = (int)$params['pageId'];
-        $srcLanguageId = (int)$params['srcLanguageId'];
         $destLanguageId = (int)$params['destLanguageId'];
 
         // Build command map
@@ -218,21 +216,20 @@ class LocalizationController
             'tt_content' => []
         ];
 
-        for ($i = 0, $count = count($params['uidList']); $i < $count; ++$i) {
-            $currentUid = $params['uidList'][$i];
-
-            if ($params['action'] === static::ACTION_LOCALIZE) {
-                $cmd['tt_content'][$currentUid] = [
-                    'localize' => $destLanguageId
-                ];
-            } else {
-                $cmd['tt_content'][$currentUid] = [
-                    'copyToLanguage' => $destLanguageId,
-                ];
+        if (isset($params['uidList']) && is_array($params['uidList'])) {
+            foreach ($params['uidList'] as $currentUid) {
+                if ($params['action'] === static::ACTION_LOCALIZE) {
+                    $cmd['tt_content'][$currentUid] = [
+                        'localize' => $destLanguageId
+                    ];
+                } else {
+                    $cmd['tt_content'][$currentUid] = [
+                        'copyToLanguage' => $destLanguageId,
+                    ];
+                }
             }
         }
 
-        /** @var DataHandler $dataHandler */
         $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
         $dataHandler->start([], $cmd);
         $dataHandler->process_cmdmap();