diff options
Diffstat (limited to 'status.php')
-rw-r--r-- | status.php | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -1,8 +1,18 @@ <?php - if (!isset($argv[1])) die("No handle hash given\n"); - $db = mysql_connect("localhost", "gentoaster", ""); - if (!$db) die("Could not connect to database ".mysql_error()."\n"); - mysql_select_db("gentoaster"); + + // Gentoaster build daemon status + // Licensed under GPL v3, see COPYING file + + require_once "config.php"; + + if (!isset($argv[1])) { + die("No handle hash given\n"); + } + $db = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD); + if (!$db) { + die("Could not connect to database ".mysql_error()."\n"); + } + mysql_select_db(MYSQL_DATABASE); $query = "SELECT handle FROM builds ". "WHERE id = '".mysql_real_escape_string($argv[1])."'"; $result = mysql_query($query); @@ -26,7 +36,7 @@ "WHERE id = '".mysql_real_escape_string($argv[1])."'"; $result = mysql_query($query); $jobres = mysql_fetch_array($result); - if ($jobres[0] !== NULL) { + if ($jobres[0] !== null) { echo "Job returned with code ".$jobres[0].": ".$jobres[1]."\n"; } else { echo "Job failed\n"; |