....
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
root
2024-08-16 12:13:57 +02:00
parent e76f402c66
commit 961765f5d0
3 changed files with 85 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ function ping_redis() {
else return false;
}
function check_redis($group="scheduler_in") {
function check_redis($group="scheduler_in", $key="") {
global $REDIS_HOST;
@@ -23,6 +23,8 @@ function check_redis($group="scheduler_in") {
//print_r($members);
foreach ($members as $member) {
if ($key!="" && $member!=$key) continue; // check a specific key in a group
$value = $redis->get($member);
$json_data = base64_decode($value);
$data = json_decode($json_data,true);

View File

@@ -28,10 +28,11 @@ if ($_POST["ADDITIONALS"]=="yes") {
$json = json_encode($_POST, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
//echo $json;
$op = "install:".date("YmdHis");
redis_set($op,$json);
// TODO preview about selected options?
// TODO - new install in progress?
//echo redis_get($op);
$key = "install:".date("YmdHis");
redis_set($key,$json);
/*
put_install_envs();
@@ -45,3 +46,66 @@ echo "<pre>".$output."</pre>";
*/
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>INSTALLER TOOL</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="installer.css?t=1" rel="stylesheet">
</head>
<body id="install" class="text-center">
<div class="container-fluid">
<div class="col-md-12">
<h1>Installing in progress... Please wait...</h1>
<div id="redis"></div>
<div id="response"></div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script>
$(function() {
function redirectToManage() {
window.location.href = 'manage.html';
}
function check_install() {
var url = 'scan.php?op=check_install&key=<?php echo $key;?>';
$.get(url, function(data){
console.log(data);
if (data=='INSTALLED') {
redirectToManage();
}
else {
$("#previous").html('Please wait...');
setTimeout(redirectToInstall, 1000);
}
});
}
var url = 'scan.php?op=redis';
$.get(url, function(data){
if (data=='OK') {
$("#redis").html('Redis server - OK');
check_install();
}
else {
$("#redis").html('Redis server is not available...');
}
});
//setTimeout(redirectToManage, 10000);
});
</script>
</body>
</html>

View File

@@ -32,6 +32,21 @@ switch ($_GET["op"]) {
}
else echo "WAIT";
break;
case "check_install":
$arr = check_redis("web_out",$_GET["key"]);
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
//echo $key."-".$_GET["key"];
if ($key==$_GET["key"]) { // if install key moved to web_out
if ($data["INSTALL_STATUS"]==1) {
redis_remove("$key");
echo "INSTALLED";
}
}
}
}
else echo "NOT EXISTS";
break;
case "docker":
echo true;
break;