SetupController - If you install and then reload the install screen, re-render the...
authorTim Otten <totten@civicrm.org>
Sat, 4 Jul 2020 03:51:31 +0000 (20:51 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 6 Jul 2020 08:52:27 +0000 (01:52 -0700)
setup/src/Setup/UI/SetupController.php

index 0d1d1a0d4abd198ed7404d33735baff3fe8e47d1..444bea24d315213819f4157212ebb45f8d01f566 100644 (file)
@@ -81,7 +81,7 @@ class SetupController implements SetupControllerInterface {
   public function runStart($method, $fields) {
     $checkInstalled = $this->setup->checkInstalled();
     if ($checkInstalled->isDatabaseInstalled() || $checkInstalled->isSettingInstalled()) {
-      return $this->createError("CiviCRM is already installed");
+      return $this->renderAlreadyInstalled();
     }
 
     /**
@@ -120,7 +120,7 @@ class SetupController implements SetupControllerInterface {
   public function runInstall($method, $fields) {
     $checkInstalled = $this->setup->checkInstalled();
     if ($checkInstalled->isDatabaseInstalled() || $checkInstalled->isSettingInstalled()) {
-      return $this->createError("CiviCRM is already installed");
+      return $this->renderAlreadyInstalled();
     }
 
     $reqs = $this->setup->checkRequirements();
@@ -130,16 +130,7 @@ class SetupController implements SetupControllerInterface {
 
     $this->setup->installFiles();
     $this->setup->installDatabase();
-
-    $m = $this->setup->getModel();
-    $tplFile = $this->getResourcePath('finished.' . $m->cms . '.php');
-    if (file_exists($tplFile)) {
-      $tplVars = array();
-      return array(array(), $this->render($tplFile, $tplVars));
-    }
-    else {
-      return $this->createError("Installation succeeded. However, the final page ($tplFile) was not available.");
-    }
+    return $this->renderFinished();
   }
 
   /**
@@ -290,4 +281,24 @@ class SetupController implements SetupControllerInterface {
     return $this->setup;
   }
 
+  private function renderAlreadyInstalled() {
+    // return $this->createError("CiviCRM is already installed");
+    return $this->renderFinished();
+  }
+
+  /**
+   * @return array
+   */
+  private function renderFinished() {
+    $m = $this->setup->getModel();
+    $tplFile = $this->getResourcePath('finished.' . $m->cms . '.php');
+    if (file_exists($tplFile)) {
+      $tplVars = array();
+      return array(array(), $this->render($tplFile, $tplVars));
+    }
+    else {
+      return $this->createError("Installation succeeded. However, the final page ($tplFile) was not available.");
+    }
+  }
+
 }