3 error_reporting(E_ALL
);
4 ini_set('display_errors', 'on');
6 class SystemExit
extends Exception
{}
9 $pageTitle = "Upgrade";
10 include('header.php');
12 require_once('config.php');
13 require_once('setup/version.php');
14 if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
15 $NEL_SETUP_VERSION_CONFIGURED = 1;
20 <div style
="margin-left: auto; margin-right: auto; max-width: 1024px;">
22 <?php
if ($_POST) { ?
>
26 // NOTE: If a config upgrade requires new information, modify the
27 // upgrade confirmation form at the bottom of this script.
29 require_once('database.php');
31 if (file_exists("role_support")) {
32 $continue = upgrade_support_databases($continue);
35 if (file_exists("role_service")) {
36 $continue = upgrade_service_databases($continue);
39 if (file_exists("role_domain")) {
40 $continue = upgrade_domain_databases($continue);
45 $config = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config.php");
47 printalert("danger", "Cannot read <em>config.php</em>");
51 $config = str_replace("%privatePhpDirectory%", addslashes($PRIVATE_PHP_PATH), $config);
52 $config = str_replace("%publicPhpDirectory%", addslashes($PUBLIC_PHP_PATH), $config);
53 $config = str_replace("%nelSqlHostname%", addslashes($cfg['db']['shard']['host']), $config);
54 $config = str_replace("%nelSqlUsername%", addslashes($cfg['db']['shard']['user']), $config);
55 $config = str_replace("%nelSqlPassword%", addslashes($cfg['db']['shard']['pass']), $config);
56 $config = str_replace("%nelDatabase%", addslashes($cfg['db']['shard']['name']), $config);
57 $config = str_replace("%toolDatabase%", addslashes($cfg['db']['tool']['name']), $config);
58 $config = str_replace("%amsSqlHostname%", addslashes($cfg['db']['lib']['host']), $config);
59 $config = str_replace("%amsSqlUsername%", addslashes($cfg['db']['lib']['user']), $config);
60 $config = str_replace("%amsSqlPassword%", addslashes($cfg['db']['lib']['pass']), $config);
61 $config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config);
62 $config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config);
63 $config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config);
64 $config = str_replace("%nelDomainName%", addslashes($NEL_DOMAIN_NAME), $config);
65 $config = str_replace("%nelSetupVersion%", addslashes($NEL_SETUP_VERSION), $config);
66 $config = str_replace("%cryptKey%", addslashes($cfg['crypt']['key']), $config);
67 $config = str_replace("%cryptKeyIMAP%", addslashes($SUPPORT_GROUP_IMAP_CRYPTKEY), $config);
68 if ($NEL_SETUP_VERSION_CONFIGURED < 2) {
69 $config = str_replace("%domainDatabase%", "mini01", $config);
71 $config = str_replace("%domainDatabase%", addslashes($cfg['db']['ring']['name']), $config);
73 if (file_put_contents("config.php", $config)) {
74 printalert("success", "Generated <em>config.php</em>");
76 printalert("danger", "Cannot write to <em>config.php</em>");
82 // Create config_user.php if it doesn't exist yet
83 if ($continue && !file_exists("config_user.php")) {
84 $configUser = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config_user.php");
86 printalert("danger", "Cannot read <em>config_user.php</em>");
89 if (file_put_contents("config_user.php", $configUser)) {
90 printalert("success", "Copied <em>config_user.php</em>");
92 printalert("danger", "Cannot write to <em>config.php</em>");
99 printalert("success", "Upgrade complete");
105 <a
class="btn btn-primary" href
="index.php">Continue</a
>
108 <?php
} else { // NOTE: This is where you may also ask for new configuration fields ?>
110 <div
class="panel panel-danger">
111 <div
class="panel-heading"><span
class="glyphicon glyphicon-hdd"></span
> Backup
</div
>
112 <div
class="panel-body">
113 It is strongly recommended to create a backup of your installation before proceeding with an upgrade
!
117 <form
class="form" role
="form" method
="POST" action
="" enctype
="application/x-www-form-urlencoded">
118 <div
class="input-group">
119 <input name
="submit" type
="submit" value
="Upgrade" class="btn btn-primary">
129 include('footer.php');
132 catch (SystemExit
$e) { /* do nothing */ }