From 69f13129101e2e4d14a7030d6674accb93e38f32 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Mon, 7 Nov 2022 17:11:56 -0800 Subject: [PATCH] bug fix (#5930) --- setup.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.php b/setup.php index 141be33bd..f2b5def39 100644 --- a/setup.php +++ b/setup.php @@ -266,12 +266,20 @@ $config = 0; if (file_exists($installer->conffile)) { require_once($installer->conffile); } elseif ($state > 3) { - // State 3 should have created the site directory if it is missing. + // State 3 should have created the site directory if it is missing. SessionUtil::setupScriptSessionStart(); SessionUtil::setupScriptSessionCookieDestroy(); die("Internal error, site directory is missing."); } +// Should never have $config set when state less than 4 +// (this means already installed) +if (!empty($config) && (($state ?? 0) < 4)) { + SessionUtil::setupScriptSessionStart(); + SessionUtil::setupScriptSessionCookieDestroy(); + error_log("OpenEMR has already been installed. If you wish to force re-installation, then edit " . errorLogEscape($installer->conffile) . " (change the 'config' variable to 0), and re-run the setup.php script."); + die("OpenEMR has already been installed. If you wish to force re-installation, see log for details.
\n"); +} // This will effectively only allow entry into the setup.php script at the first step and will bar entry to the // script if openemr has already been installed. -- 2.11.4.GIT