[TASK] Cleanup code of LocalizationController::process 36/51436/2
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:58:07 +0000 (08:58 +0100)
Change-Id: I6db726bfff61c092309a971eb71e074c30cad046
Releases: master, 7.6
Resolves: #79378
Reviewed-on: https://review.typo3.org/51436
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 c11bbc7..9b0682e 100644 (file)
@@ -204,8 +204,6 @@ class LocalizationController
      */
     protected function process($params)
     {
-        $pageId = (int)$params['pageId'];
-        $srcLanguageId = (int)$params['srcLanguageId'];
         $destLanguageId = (int)$params['destLanguageId'];
 
         // Build command map
@@ -213,21 +211,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();