From 7fb6cf4c86cdc4e561ac2901dd2d859dc8ae3ac2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 3 Jul 2020 20:51:31 -0700 Subject: [PATCH] SetupController - If you install and then reload the install screen, re-render the finish message. --- setup/src/Setup/UI/SetupController.php | 35 +++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/setup/src/Setup/UI/SetupController.php b/setup/src/Setup/UI/SetupController.php index 0d1d1a0d4a..444bea24d3 100644 --- a/setup/src/Setup/UI/SetupController.php +++ b/setup/src/Setup/UI/SetupController.php @@ -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."); + } + } + } -- 2.25.1