diff --git a/functions.php b/functions.php index a99f26d..d9db2ef 100644 --- a/functions.php +++ b/functions.php @@ -12,7 +12,7 @@ function ping_redis() { else return false; } -function check_install() { +function check_install() { // is install in progress global $REDIS_HOST; @@ -42,8 +42,9 @@ function check_redis($group="scheduler_in", $key="") { $members = $redis->sMembers($group); // redis-cli -h redis-server smembers $group //print_r($members); + $result = array(); foreach ($members as $member) { - if ($key!="" && $member!=$key) continue; // check a specific key in a group + if ($key!="" && $member!=$key) continue; // find a specific key in a group $value = $redis->get($member); $json_data = base64_decode($value); @@ -52,10 +53,11 @@ function check_redis($group="scheduler_in", $key="") { echo "JSON read error..."; // TODO json error } - else { - return array("$member" => $data); + else { + $result["$member"] = $data; } } + return $result; } } diff --git a/index.html b/index.html index 4ed05dd..3c6f02a 100644 --- a/index.html +++ b/index.html @@ -48,12 +48,12 @@ function redirectToManage() { window.location.href = 'manage.html'; } -function start_init() { - var url = 'scan.php?op=init'; +function start_system() { + var url = 'scan.php?op=system'; $.get(url, function(data){ if (data=='OK') { $("#previous").html('Scanning for previous install. Please wait...'); - check_init(); + check_system(); } else { $("#previous").html('Scanning for previous install has aborted...'); @@ -61,8 +61,8 @@ function start_init() { }); } -function check_init() { - var url = 'scan.php?op=check_init'; +function check_system() { + var url = 'scan.php?op=check_system'; $.get(url, function(data){ console.log(data); if (data=='NEW') { @@ -74,7 +74,7 @@ function check_init() { setTimeout(redirectToManage, 3000); } else if (data=='WAIT') { - setTimeout(check_init, 1000); + setTimeout(check_system, 1000); } else { // UNEXPECTED ERROR @@ -86,7 +86,7 @@ function check_init() { $.get(url, function(data){ if (data=='OK') { $("#redis").html('Redis server - OK'); - start_init(); + start_system(); } else { $("#redis").html('Redis server is not available...'); diff --git a/manage.html b/manage.html index b6bf040..0670b74 100644 --- a/manage.html +++ b/manage.html @@ -70,6 +70,7 @@