Setup adjust
This commit is contained in:
parent
6a3d59f6f5
commit
d7c1249b6b
4 changed files with 47 additions and 30 deletions
|
@ -137,7 +137,7 @@ $NEL_SETUP_PASSWORD = '%nelSetupPassword%';
|
||||||
$NEL_DOMAIN_NAME = '%nelDomainName%';
|
$NEL_DOMAIN_NAME = '%nelDomainName%';
|
||||||
|
|
||||||
// Currently configured setup version
|
// Currently configured setup version
|
||||||
$NEL_SETUP_VERSION_CONFIGURED = '%nelSetupVersion%';
|
$NEL_SETUP_VERSION_CONFIGURED = (int)'%nelSetupVersion%';
|
||||||
|
|
||||||
// Get installed version
|
// Get installed version
|
||||||
require_once('setup/version.php');
|
require_once('setup/version.php');
|
||||||
|
|
|
@ -20,11 +20,18 @@ try {
|
||||||
|
|
||||||
if (!file_exists('../role_support')) {
|
if (!file_exists('../role_support')) {
|
||||||
header("Cache-Control: max-age=1");
|
header("Cache-Control: max-age=1");
|
||||||
header('Location: ../setup', true, 303);
|
header('Location: ../setup?reason=no_role_support&from=ams', true, 303);
|
||||||
throw new SystemExit();
|
throw new SystemExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
require( '../config.php' );
|
require( '../config.php' );
|
||||||
|
|
||||||
|
if ($NEL_SETUP_VERSION_CONFIGURED < $NEL_SETUP_VERSION) {
|
||||||
|
header("Cache-Control: max-age=1");
|
||||||
|
header('Location: ../setup?reason=upgrade&from=ams', true, 303);
|
||||||
|
throw new SystemExit();
|
||||||
|
}
|
||||||
|
|
||||||
require_once( $AMS_LIB . '/libinclude.php' );
|
require_once( $AMS_LIB . '/libinclude.php' );
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Service
|
||||||
|
$db_nel = 3;
|
||||||
|
$db_nel_tool = 1;
|
||||||
|
|
||||||
|
// Support
|
||||||
|
$db_nel_ams = 1
|
||||||
|
$db_nel_ams_lib = 3;
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
$db_ring_domain = 1;
|
||||||
|
|
||||||
|
|
||||||
function set_db_version($continue_r, $name, $version) {
|
function set_db_version($continue_r, $name, $version) {
|
||||||
$continue = $continue_r;
|
$continue = $continue_r;
|
||||||
|
|
||||||
|
@ -53,26 +65,22 @@ function upgrade_service_databases($continue_r) {
|
||||||
$con = null;
|
$con = null;
|
||||||
$con = connect_database($continue, "shard");
|
$con = connect_database($continue, "shard");
|
||||||
$continue = ($con != null);
|
$continue = ($con != null);
|
||||||
if ($continue && get_db_version("shard") < 1) {
|
for ($i = 1; $i <= $db_nel; $i++) {
|
||||||
$continue = update_database_structure($continue, $con, "nel_00001.sql");
|
if ($continue && get_db_version("shard") < $i) {
|
||||||
$continue = set_db_version($continue, "shard", 1);
|
$continue = update_database_structure($continue, $con, "nel_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
|
||||||
}
|
$continue = set_db_version($continue, "shard", $i);
|
||||||
if ($continue && get_db_version("shard") < 2) {
|
}
|
||||||
$continue = update_database_structure($continue, $con, "nel_00002.sql");
|
|
||||||
$continue = set_db_version($continue, "shard", 2);
|
|
||||||
}
|
|
||||||
if ($continue && get_db_version("shard") < 3) {
|
|
||||||
$continue = update_database_structure($continue, $con, "nel_00003.sql");
|
|
||||||
$continue = set_db_version($continue, "shard", 3);
|
|
||||||
}
|
}
|
||||||
disconnect_database($con, "shard");
|
disconnect_database($con, "shard");
|
||||||
|
|
||||||
$con = null;
|
$con = null;
|
||||||
$con = connect_database($continue, "tool");
|
$con = connect_database($continue, "tool");
|
||||||
$continue = ($con != null);
|
$continue = ($con != null);
|
||||||
if ($continue && get_db_version("tool") < 1) {
|
for ($i = 1; $i <= $db_nel_tool; $i++) {
|
||||||
$continue = update_database_structure($continue, $con, "nel_tool_00001.sql");
|
if ($continue && get_db_version("tool") < $i) {
|
||||||
$continue = set_db_version($continue, "tool", 1);
|
$continue = update_database_structure($continue, $con, "nel_tool_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
|
||||||
|
$continue = set_db_version($continue, "tool", $i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
disconnect_database($con, "tool");
|
disconnect_database($con, "tool");
|
||||||
|
|
||||||
|
@ -85,22 +93,22 @@ function upgrade_support_databases($continue_r) {
|
||||||
$con = null;
|
$con = null;
|
||||||
$con = connect_database($continue, "web");
|
$con = connect_database($continue, "web");
|
||||||
$continue = ($con != null);
|
$continue = ($con != null);
|
||||||
if ($continue && get_db_version("web") < 1) {
|
for ($i = 1; $i <= $db_nel_ams; $i++) {
|
||||||
$continue = update_database_structure($continue, $con, "nel_ams_00001.sql");
|
if ($continue && get_db_version("web") < $i) {
|
||||||
$continue = set_db_version($continue, "web", 1);
|
$continue = update_database_structure($continue, $con, "nel_ams_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
|
||||||
|
$continue = set_db_version($continue, "web", $i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
disconnect_database($con, "web");
|
disconnect_database($con, "web");
|
||||||
|
|
||||||
$con = null;
|
$con = null;
|
||||||
$con = connect_database($continue, "lib");
|
$con = connect_database($continue, "lib");
|
||||||
$continue = ($con != null);
|
$continue = ($con != null);
|
||||||
if ($continue && get_db_version("lib") < 1) {
|
for ($i = 1; $i <= $db_nel_ams_lib; $i++) {
|
||||||
$continue = update_database_structure($continue, $con, "nel_ams_lib_00001.sql");
|
if ($continue && get_db_version("lib") < $i) {
|
||||||
$continue = set_db_version($continue, "lib", 1);
|
$continue = update_database_structure($continue, $con, "nel_ams_lib_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
|
||||||
}
|
$continue = set_db_version($continue, "lib", $i);
|
||||||
if ($continue && get_db_version("lib") < 2) {
|
}
|
||||||
$continue = update_database_structure($continue, $con, "nel_ams_lib_00002.sql");
|
|
||||||
$continue = set_db_version($continue, "lib", 2);
|
|
||||||
}
|
}
|
||||||
disconnect_database($con, "lib");
|
disconnect_database($con, "lib");
|
||||||
|
|
||||||
|
@ -113,9 +121,11 @@ function upgrade_domain_databases($continue_r) {
|
||||||
$con = null;
|
$con = null;
|
||||||
$con = connect_database($continue, "ring");
|
$con = connect_database($continue, "ring");
|
||||||
$continue = ($con != null);
|
$continue = ($con != null);
|
||||||
if ($continue && get_db_version("ring") < 1) {
|
for ($i = 1; $i <= $db_ring_domain; $i++) {
|
||||||
$continue = update_database_structure($continue, $con, "ring_domain_00001.sql");
|
if ($continue && get_db_version("ring") < $i) {
|
||||||
$continue = set_db_version($continue, "ring", 1);
|
$continue = update_database_structure($continue, $con, "ring_domain_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
|
||||||
|
$continue = set_db_version($continue, "ring", $i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
disconnect_database($con, "ring");
|
disconnect_database($con, "ring");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Increment whenever a web upgrade is required.
|
// Increment whenever a web upgrade is required.
|
||||||
$NEL_SETUP_VERSION = 3;
|
$NEL_SETUP_VERSION = 4;
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|
Loading…
Reference in a new issue