aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-08-04 22:04:00 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-08-04 22:04:00 +0100
commit0b2091cc10ccb748adc89c58a19b367308f047c7 (patch)
tree2445230a171f1d2b41c915182b4d6d73145cf259 /web
parentAdd options for configuring default keyboard layout and timezone (diff)
downloadgentoaster-0b2091cc10ccb748adc89c58a19b367308f047c7.tar.gz
gentoaster-0b2091cc10ccb748adc89c58a19b367308f047c7.tar.bz2
gentoaster-0b2091cc10ccb748adc89c58a19b367308f047c7.zip
Fix simultaneous build detection, fix sorting on keyboard layouts
Diffstat (limited to 'web')
-rw-r--r--web/index.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/web/index.php b/web/index.php
index 4903bbb..dcaae6b 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,18 +23,23 @@
FILTER_VALIDATE_IP
);
- $query = "SELECT id, returncode ".
+ $query = "SELECT id, handle ".
"FROM builds WHERE ipaddress = ?";
$stmt = $db->prepare($query);
- $stmt->bind_param("sd", $ipaddress, $returncode);
+ $stmt->bind_param("s", $ipaddress);
$stmt->execute();
$stmt->store_result();
- if ($stmt->num_rows == 1 && $returncode === null) {
- $stmt->bind_result($buildID);
+ if ($stmt->num_rows == 1) {
+ $stmt->bind_result($buildID, $handle);
$stmt->fetch();
- $url = "status.php?uuid=".$buildID."&simultaneous=true";
- header("Location: ".$url);
+ $client = new GearmanClient();
+ $client->addServer();
+ $status = $client->jobStatus($handle);
+ if ($status[0]) {
+ $url = "status.php?uuid=".$buildID."&simultaneous=true";
+ header("Location: ".$url);
+ }
}
$stmt->close();
}
@@ -65,17 +70,21 @@
}
$layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
$keyboardOption = "";
+ $layouts = array();
foreach($layoutLines as $layout) {
$layoutdata = explode("\t", $layout);
- $keyboardOption .= "<option value=\"".$layoutdata[0]."\"";
- if ($layoutdata[0] == DEFAULT_KEYBOARD) {
+ $layouts[$layoutdata[0]] = $layoutdata[1];
+ }
+ asort($layouts);
+
+ foreach($layouts as $layoutCode => $layoutName) {
+ $keyboardOption .= "<option value=\"".$layoutCode."\"";
+ if ($layoutCode == DEFAULT_KEYBOARD) {
$keyboardOption .= " selected";
}
- $keyboardOption .= ">".trim($layoutdata[1])."</option>\n";
+ $keyboardOption .= ">".trim($layoutName)."</option>\n";
}
-
- asort($layouts);
?>
<html>
<head>