check install in progress
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,6 +12,28 @@ function ping_redis() {
|
|||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_install() {
|
||||||
|
|
||||||
|
global $REDIS_HOST;
|
||||||
|
|
||||||
|
$redis = new Redis();
|
||||||
|
$redis->connect($REDIS_HOST);
|
||||||
|
if ($redis->ping()) {
|
||||||
|
$members = $redis->sMembers("web_in"); // redis-cli -h redis-server smembers $group
|
||||||
|
print_r($members);
|
||||||
|
|
||||||
|
$in_progress=0;
|
||||||
|
foreach ($members as $member) {
|
||||||
|
echo substr($member,0,7);
|
||||||
|
if (substr($member,0,7)=="install") {
|
||||||
|
$in_progress=$member;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $in_progress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function check_redis($group="scheduler_in", $key="") {
|
function check_redis($group="scheduler_in", $key="") {
|
||||||
|
|
||||||
global $REDIS_HOST;
|
global $REDIS_HOST;
|
||||||
|
@@ -31,9 +31,15 @@ $json = json_encode($_POST, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
|||||||
// TODO preview about selected options?
|
// TODO preview about selected options?
|
||||||
// TODO - new install in progress? INSTALL_STATUS=0
|
// TODO - new install in progress? INSTALL_STATUS=0
|
||||||
|
|
||||||
|
if ($key=check_install()) {
|
||||||
|
$header_text="Install has already started.<br>Please wait and do not start a new one...";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$header_text="Installing in progress... Please wait...";
|
||||||
$key = "install:".date("YmdHis");
|
$key = "install:".date("YmdHis");
|
||||||
redis_set($key,$json);
|
redis_set($key,$json);
|
||||||
//$key = "install:20240816101849"; // DEBUG
|
//$key = "install:20240816101849"; // DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
put_install_envs();
|
put_install_envs();
|
||||||
@@ -62,7 +68,7 @@ echo "<pre>".$output."</pre>";
|
|||||||
<body id="install" class="text-center">
|
<body id="install" class="text-center">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h1>Installing in progress... Please wait...</h1>
|
<h1><?php echo $header_text?></h1>
|
||||||
<div id="redis"></div>
|
<div id="redis"></div>
|
||||||
<div id="response"></div>
|
<div id="response"></div>
|
||||||
</div>
|
</div>
|
||||||
|
2
scan.php
2
scan.php
@@ -38,7 +38,7 @@ switch ($_GET["op"]) {
|
|||||||
foreach ($arr as $key=>$data) {
|
foreach ($arr as $key=>$data) {
|
||||||
//echo $key."-".$_GET["key"];
|
//echo $key."-".$_GET["key"];
|
||||||
if ($key==$_GET["key"]) { // if install key moved to web_out
|
if ($key==$_GET["key"]) { // if install key moved to web_out
|
||||||
if ($data["INSTALL_STATUS"]==1) {
|
if ($data["INSTALL_STATUS"]>0) {
|
||||||
redis_remove("$key");
|
redis_remove("$key");
|
||||||
echo "INSTALLED";
|
echo "INSTALLED";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user