deploy
This commit is contained in:
@@ -32,6 +32,26 @@ function check_install() { // is install in progress
|
||||
}
|
||||
}
|
||||
|
||||
function check_deploy() { // is a deploy in progress
|
||||
|
||||
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
|
||||
|
||||
$in_progress=0;
|
||||
foreach ($members as $member) {
|
||||
if (substr($member,0,7)=="deploy") {
|
||||
$in_progress=$member;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $in_progress;
|
||||
}
|
||||
}
|
||||
|
||||
function check_redis($group="scheduler_in", $key="") {
|
||||
|
||||
global $REDIS_HOST;
|
||||
|
26
scan.php
26
scan.php
@@ -99,6 +99,32 @@ switch ($_GET["op"]) {
|
||||
}
|
||||
else echo "";
|
||||
break;
|
||||
case "deploy":
|
||||
if ($key=check_deploy()) {
|
||||
$header_text="A deployment has already started.<br>Please wait and do not start a new one...";
|
||||
}
|
||||
else {
|
||||
$header_text="Installing in progress... Please wait...";
|
||||
$key = "deploy:".date("YmdHis");
|
||||
redis_set($key,$json);
|
||||
//$key = "deploy:20240816101849"; // DEBUG
|
||||
}
|
||||
break;
|
||||
case "check_deploy":
|
||||
$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"]>0) {
|
||||
redis_remove("$key");
|
||||
echo "INSTALLED";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else echo "NOT EXISTS";
|
||||
break;
|
||||
case "repositories":
|
||||
$arr = array("STATUS" => 0);
|
||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
|
Reference in New Issue
Block a user