diff --git a/functions.php b/functions.php index ce5fd72..ab1b104 100644 --- a/functions.php +++ b/functions.php @@ -31,7 +31,7 @@ function check_redis($group="scheduler_in") { // TODO json error } else { - return $data; + return array("$member" => $data); } } } @@ -80,6 +80,8 @@ function redis_set($key, $value) { function redis_remove($key) { + global $REDIS_HOST; + $redis = new Redis(); $redis->connect($REDIS_HOST); // $redis->auth('password'); diff --git a/index.html b/index.html index 7a4eebb..93a989f 100644 --- a/index.html +++ b/index.html @@ -62,9 +62,12 @@ function check_init() { $("#previous").html('Previous install has found...'); setTimeout(redirectToManage, 3000); } - else { + else if (data=='WAIT') { setTimeout(check_init, 1000); } + else { + // UNEXPECTED ERROR + } }); } diff --git a/scan.php b/scan.php index 4527b22..74f9808 100644 --- a/scan.php +++ b/scan.php @@ -22,10 +22,14 @@ switch ($_GET["op"]) { echo "OK"; // TODO? break; case "check_init": - echo "NEW";exit;// TEMP-TEST - $data = check_redis("web_out"); - if ($data["STATUS"]==2) echo "NEW"; - elseif ($data["STATUS"]==1) echo "EXISTS"; + $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 "docker":