aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-07-11 14:59:51 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-07-11 14:59:51 +0100
commitcb7c822b0284d11d16b49023162820d1ffca6fdd (patch)
tree18102deaecf445568d30bb63187294b0cceb10f2 /client.php
parentAdded compress flag to build tool (diff)
downloadgentoaster-cb7c822b0284d11d16b49023162820d1ffca6fdd.tar.gz
gentoaster-cb7c822b0284d11d16b49023162820d1ffca6fdd.tar.bz2
gentoaster-cb7c822b0284d11d16b49023162820d1ffca6fdd.zip
Fixed hostname setting and changed Gearman daemon/client to meet Zend coding standard
Diffstat (limited to 'client.php')
-rw-r--r--client.php34
1 files changed, 19 insertions, 15 deletions
diff --git a/client.php b/client.php
index ec7e354..ce4bc1f 100644
--- a/client.php
+++ b/client.php
@@ -1,23 +1,27 @@
<?php
- // Gentoaster build daemon client
- // Licensed under GPL v3, see COPYING file
+ // Gentoaster build daemon client
+ // Licensed under GPL v3, see COPYING file
- if(!isset($argv[1])) die("No config file provided\n");
+ if(!isset($argv[1])) die("No config file provided\n");
- $client= new GearmanClient();
- $client->addServer();
+ $client= new GearmanClient();
+ $client->addServer();
- echo "Sending job\n";
+ echo "Sending job\n";
- $handle = $client->doBackground("invoke_image_build", file_get_contents($argv[1]));
- $handlehash = md5($handle);
+ $iniString = file_get_contents($argv[1]);
- echo "Job sent, handle was ".$handle." - hash ".$handlehash."\n";
+ $handle = $client->doBackground("invoke_image_build", $iniString);
+ $handlehash = md5($handle);
+
+ echo "Job sent, handle was ".$handle." - hash ".$handlehash."\n";
+
+ $db = mysql_connect("localhost", "gentoaster", "");
+ if(!$db) die("Could not connect to database ".mysql_error());
+ mysql_select_db("gentoaster");
+ $query = "INSERT INTO builds (id, handle)".
+ ." VALUES('".$handlehash."','".$handle."')";
+ mysql_query($query);
+ echo "Job handle mapping added to database\n";
- $db = mysql_connect("localhost","gentoaster","");
- if(!$db) die("Could not connect to database ".mysql_error());
- mysql_select_db("gentoaster");
- mysql_query("INSERT INTO builds (id, handle) VALUES('".$handlehash."','".$handle."')");
- echo "Job handle mapping added to database\n";
-?>