diff --git a/tool/quick_start_win10/external/web_config.bat b/tool/quick_start_win10/external/web_config.bat deleted file mode 100644 index fbd3fa500..000000000 --- a/tool/quick_start_win10/external/web_config.bat +++ /dev/null @@ -1,8 +0,0 @@ -call ..\path_config.bat -set PATH=%RC_PYTHON2%;%PATH% -python web_config.py -cd mariadb -.\bin\mysql -P 9040 -u root < ..\web_config_local.sql -if %errorlevel% neq 0 pause -cd .. -pause diff --git a/tool/quick_start_win10/external/web_config.py b/tool/quick_start_win10/external/web_config.py deleted file mode 100644 index f73d55a2e..000000000 --- a/tool/quick_start_win10/external/web_config.py +++ /dev/null @@ -1,8 +0,0 @@ -import socket, os -hostname = socket.gethostname() -root = os.getenv('RC_ROOT').replace('\\', '/') -shardDev = root + '/pipeline/shard_dev' -with open("web_config.sql", "r") as fr: - with open("web_config_local.sql", "w") as fw: - for l in fr: - fw.write(l.replace("%RC_HOSTNAME%", hostname).replace("%RC_SHARD_DEV%", shardDev)) diff --git a/tool/quick_start_win10/external/web_config.sql b/web/private_php/setup/sql/configure_shard_dev.sql similarity index 100% rename from tool/quick_start_win10/external/web_config.sql rename to web/private_php/setup/sql/configure_shard_dev.sql diff --git a/web/public_php/setup/database.php b/web/public_php/setup/database.php index 4c784149b..b22ec18a5 100644 --- a/web/public_php/setup/database.php +++ b/web/public_php/setup/database.php @@ -140,4 +140,16 @@ function upgrade_domain_databases($continue_r) { return $continue; } +function configure_shard_dev($continue_r) { + $continue = $continue_r; + + $con = null; + $con = connect_database($continue, "ring"); + $continue = ($con != null); + $continue = update_database_configure($continue, $con, "configure_shard_dev.sql"); + disconnect_database($con, "ring"); + + return $continue; +} + ?> diff --git a/web/public_php/setup/header.php b/web/public_php/setup/header.php index 11d64213a..fe7d5bed1 100644 --- a/web/public_php/setup/header.php +++ b/web/public_php/setup/header.php @@ -103,6 +103,31 @@ function update_database_structure($continue_r, $con, $file) { } return $continue; } +function update_database_configure($continue_r, $con, $file) { + $continue = $continue_r; + global $PRIVATE_PHP_PATH; + if ($continue) { + $sql = file_get_contents($PRIVATE_PHP_PATH . "/setup/sql/" . $file); + $sql = str_replace('%RC_HOSTNAME%', mysqli_real_escape_string($con, gethostname()), $sql); + $shardDevDir = str_replace('/www', '', str_replace('\\', '/', $_POST["domainUsersDir"])); + $sql = str_replace('%RC_SHARD_DEV%', mysqli_real_escape_string($con, $shardDevDir), $sql); + if (!$sql) { + printalert("danger", "Cannot read " . $file . ""); + $continue = false; + } else { + if (mysqli_multi_query($con, $sql)) { + printalert("success", "Database updated using " . $file . ""); + while (mysqli_more_results($con) && mysqli_next_result($con)) { + // no-op + } + } else { + printalert("danger", "Error updating database using " . $file . ": " . mysqli_error($con)); + $continue = false; + } + } + } + return $continue; +} ?>
diff --git a/web/public_php/setup/install.php b/web/public_php/setup/install.php index 1d51f0538..35a8b44a1 100644 --- a/web/public_php/setup/install.php +++ b/web/public_php/setup/install.php @@ -11,8 +11,8 @@ include('header.php'); require_once('setup/version.php'); -$shardWinDev = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); -$shardDev = $shardWinDev; +$shardDev = isset($_GET['dev']); +$shardWin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); ?> @@ -33,6 +33,7 @@ $shardDev = $shardWinDev; $roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on"; $roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on"; $roleDomain = isset($_POST["roleDomain"]) && $_POST["roleDomain"] == "on"; + $configureShardDev = isset($_POST["configureShardDev"]) && $_POST["configureShardDev"] == "on"; $continue = true; @@ -265,8 +266,10 @@ $shardDev = $shardWinDev; } } - if ($roleDomain) { - // TODO: Register the domain with the nel database etc + if ($continue && $roleDomain) { + if ($configureShardDev) { + $continue = configure_shard_dev($continue) && $continue; + } } if ($continue && $roleService) { @@ -490,6 +493,7 @@ $shardDev = $shardWinDev;There can be multiple instances of the domain role, there can only be one support and one service role setup.