[TASK] Install tool: Code optimization in update wizard action 15/21515/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Wed, 19 Jun 2013 20:11:04 +0000 (22:11 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 19 Jun 2013 20:13:41 +0000 (22:13 +0200)
An if with only a 'throw Exception' call in it breaks code execution
and acts as a guard clause. The code below does not need to be in
an else case.

Change-Id: Ib24ed4bee06763fb46145b815a0b6f3fdf7bafa6
Resolves: #49263
Related: #49162
Releases: 6.2
Reviewed-on: https://review.typo3.org/21515
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php

index 22aeb4e..17e392f 100644 (file)
@@ -166,28 +166,28 @@ class UpdateWizard extends Action\AbstractAction implements Action\ActionInterfa
                                        'No performUpdate method in update wizard with identifier ' . $wizardIdentifier,
                                        1371035200
                                );
+                       }
+
+                       // Both variables are used by reference in performUpdate()
+                       $customOutput = '';
+                       $databaseQueries = array();
+                       $performResult = $updateObject->performUpdate($databaseQueries, $customOutput);
+
+                       if ($performResult) {
+                               /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
+                               $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\OkStatus');
+                               $message->setTitle('Update successful');
                        } else {
-                               // Both variables are used by reference in performUpdate()
-                               $customOutput = '';
-                               $databaseQueries = array();
-                               $performResult = $updateObject->performUpdate($databaseQueries, $customOutput);
-
-                               if ($performResult) {
-                                       /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                                       $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\OkStatus');
-                                       $message->setTitle('Update successful');
-                               } else {
-                                       /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                                       $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
-                                       $message->setTitle('Update failed!');
-                                       if ($customOutput) {
-                                               $message->setMessage($customOutput);
-                                       }
+                               /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
+                               $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                               $message->setTitle('Update failed!');
+                               if ($customOutput) {
+                                       $message->setMessage($customOutput);
                                }
+                       }
 
-                               if ($this->postValues['values']['showDatabaseQueries'] == 1) {
-                                       $wizardData['queries'] = $databaseQueries;
-                               }
+                       if ($this->postValues['values']['showDatabaseQueries'] == 1) {
+                               $wizardData['queries'] = $databaseQueries;
                        }
                }