From 510bb2074ba321d3fcd384102989fb7a6232a4b7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 6 Sep 2014 04:44:08 +0200 Subject: [PATCH] Add upgrade script --- code/web/public_php/setup/install.php | 2 - code/web/public_php/setup/upgrade.php | 99 +++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 code/web/public_php/setup/upgrade.php diff --git a/code/web/public_php/setup/install.php b/code/web/public_php/setup/install.php index 456018c5d..f8dfbdab2 100644 --- a/code/web/public_php/setup/install.php +++ b/code/web/public_php/setup/install.php @@ -133,8 +133,6 @@ include('header.php'); $config = str_replace("%amsSqlPassword%", addslashes($_POST["amsSqlPassword"]), $config); $config = str_replace("%amsDatabase%", addslashes($_POST["amsDatabase"]), $config); $config = str_replace("%amsLibDatabase%", addslashes($_POST["amsLibDatabase"]), $config); - $config = str_replace("%amsAdminUsername%", addslashes($_POST["amsAdminUsername"]), $config); - $config = str_replace("%amsAdminPassword%", addslashes($_POST["amsAdminPassword"]), $config); $config = str_replace("%nelSetupPassword%", addslashes($_POST["nelSetupPassword"]), $config); $config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config); $config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config); diff --git a/code/web/public_php/setup/upgrade.php b/code/web/public_php/setup/upgrade.php new file mode 100644 index 000000000..f8cebb9e2 --- /dev/null +++ b/code/web/public_php/setup/upgrade.php @@ -0,0 +1,99 @@ + + +
+ + + +config.php"); + $continue = false; + } else { + $cwd = getcwd(); + $config = str_replace("%privatePhpDirectory%", addslashes($PRIVATE_PHP_PATH), $config); + $config = str_replace("%publicPhpDirectory%", addslashes($PUBLIC_PHP_PATH), $config); + $config = str_replace("%nelSqlHostname%", addslashes($cfg['db']['shard']['host']), $config); + $config = str_replace("%nelSqlUsername%", addslashes($cfg['db']['shard']['user']), $config); + $config = str_replace("%nelSqlPassword%", addslashes($cfg['db']['shard']['pass']), $config); + $config = str_replace("%nelDatabase%", addslashes($cfg['db']['shard']['name']), $config); + $config = str_replace("%toolDatabase%", addslashes($cfg['db']['tool']['name']), $config); + $config = str_replace("%amsSqlHostname%", addslashes($cfg['db']['lib']['host']), $config); + $config = str_replace("%amsSqlUsername%", addslashes($cfg['db']['lib']['user']), $config); + $config = str_replace("%amsSqlPassword%", addslashes($cfg['db']['lib']['pass']), $config); + $config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config); + $config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config); + $config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config); + // $config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config); // TODO + $config = str_replace("%nelDomainName%", addslashes($NEL_DOMAIN_NAME), $config); + if (file_put_contents("config.php", $config)) { + printalert("success", "Generated config.php"); + } else { + printalert("danger", "Cannot write to config.php"); + $continue = false; + } + } + } + + require_once('database.php'); + + if (file_exists("role_support")) { + $continue = upgrade_support_databases($continue); + } + + if (file_exists("role_service")) { + $continue = upgrade_service_databases($continue); + } + + if (file_exists("role_domain")) { + $continue = upgrade_domain_databases($continue); + } + +?> + +

+ Continue +

+ + + +
+
Backup
+
+ It is strongly recommended to create a backup of your installation before proceeding with an upgrade! +
+
+ +
+
+ +
+
+ + + +
+ +