Skip selectSetupLanguage() and showLicense() in developer mode by using gotoNextStep()
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 7 Dec 2022 15:26:42 +0000 (16:26 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 7 Dec 2022 15:26:42 +0000 (16:26 +0100)
While this adds additional HTTP requests, it cleans up the dispatcher,
specifically getting rid of the fall-through logic, making the setup cleaner
with negligible performance loss.

wcfsetup/install/files/lib/system/WCFSetup.class.php

index 9faed519963449ecf1b4dae4041a4db3b179ed79..922fb14052b9cd7d65d641bf9d9a787417a3537e 100644 (file)
@@ -222,29 +222,19 @@ final class WCFSetup extends WCF
         // execute current step
         switch ($step) {
             case 'selectSetupLanguage':
-                if (!self::$developerMode) {
-                    $this->calcProgress(0);
+                $this->calcProgress(0);
 
-                    return $this->selectSetupLanguage();
-                }
+                return $this->selectSetupLanguage();
 
-                // no break
             case 'showLicense':
-                if (!self::$developerMode) {
-                    $this->calcProgress(1);
+                $this->calcProgress(1);
 
-                    return $this->showLicense();
-                }
+                return $this->showLicense();
 
-                // no break
             case 'showSystemRequirements':
-                if (!self::$developerMode) {
-                    $this->calcProgress(2);
-
-                    return $this->showSystemRequirements();
-                }
+                $this->calcProgress(2);
 
-                // no break
+                return $this->showSystemRequirements();
 
             case 'configureDB':
                 $this->calcProgress(3);
@@ -288,6 +278,10 @@ final class WCFSetup extends WCF
      */
     protected function selectSetupLanguage(): ResponseInterface
     {
+        if (self::$developerMode) {
+            return $this->gotoNextStep('showLicense');
+        }
+
         return new HtmlResponse(
             WCF::getTPL()->fetchStream(
                 'stepSelectSetupLanguage',
@@ -305,6 +299,10 @@ final class WCFSetup extends WCF
      */
     protected function showLicense(): ResponseInterface
     {
+        if (self::$developerMode) {
+            return $this->gotoNextStep('showSystemRequirements');
+        }
+
         $missingAcception = false;
 
         if (isset($_POST['send'])) {