Files
web-installer/scan.php
root cdadfe0b84
All checks were successful
continuous-integration/drone/push Build is passing
get containers
2024-08-16 14:07:24 +02:00

75 lines
1.5 KiB
PHP

<?php
include "functions.php";
sleep(1);
switch ($_GET["op"]) {
case "redis":
try {
$ret = ping_redis();
if ($ret===false) {
echo "Can't ping redis-server";
}
else echo "OK";
} catch (RedisException $e) {
echo "RedisException caught: " . $e->getMessage();
}
break;
case "init":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "init:".date("YmdHis");
redis_set($op,$json);
echo "OK"; // TODO?
break;
case "check_init":
$arr = check_redis("web_out");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($data["INSTALL_STATUS"]==2) echo "NEW";
elseif ($data["INSTALL_STATUS"]==1) echo "EXISTS";
redis_remove("$key");
}
}
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"]>0) {
redis_remove("$key");
echo "INSTALLED";
}
}
}
}
else echo "NOT EXISTS";
break;
case "containers":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "containers";
redis_set($op,$json);
echo "OK"; // TODO?
case "check_containers":
$arr = check_redis("web_out","containers");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($key=="containers") {
echo $data["RESULT"];
}
}
}
break;
case "docker":
echo true;
break;
}
?>