PLD-doc: PLD_www_res/buildlogs.sql/addlog.php - added the configur...

witekfl witekfl at pld-linux.org
Sat Nov 24 12:10:38 CET 2007


Author: witekfl                      Date: Sat Nov 24 11:10:38 2007 GMT
Module: PLD-doc                       Tag: HEAD
---- Log message:
- added the configuration file buildlogs.inc

---- Files affected:
PLD-doc/PLD_www_res/buildlogs.sql:
   addlog.php (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: PLD-doc/PLD_www_res/buildlogs.sql/addlog.php
diff -u PLD-doc/PLD_www_res/buildlogs.sql/addlog.php:1.2 PLD-doc/PLD_www_res/buildlogs.sql/addlog.php:1.3
--- PLD-doc/PLD_www_res/buildlogs.sql/addlog.php:1.2	Sun Nov 18 11:00:17 2007
+++ PLD-doc/PLD_www_res/buildlogs.sql/addlog.php	Sat Nov 24 12:10:33 2007
@@ -3,6 +3,8 @@
 // $Revision$, $Date$
 $database = 'sqlite:/home/services/ftp/buildlogs.db';
 $root_directory = '/home/services/ftp/pub/pld-buildlogs';
+// $database and $root_directory are taken from buildlogs.inc .
+include_once('buildlogs.inc');
 // parameter: argv[1] - full path to the log file.
 // Keep in sync with database
 $result = array("FAIL" => 0, "OK" => 1);
@@ -28,18 +30,27 @@
 	"ac/sparc64" => 19
 );
 
+if (!isset($argv[1])) {
+	die("Usage: $argv[0] full_path_to_the_log\n");
+}
 preg_match("|$root_directory/(.*/.*)/(.*)/(.*)\.bz2|", $argv[1], $matches);
 
 $arch_name = $matches[1];
-if (!array_key_exists($arch_name, $arch)) exit;
+if (!array_key_exists($arch_name, $arch)) {
+	die("$argv[1]: Nieznana architektura \"$arch_name\"\n");
+}
 else $arch_id = $arch[$arch_name];
 
 $result_name = $matches[2];
-if (!array_key_exists($result_name, $result)) exit;
+if (!array_key_exists($result_name, $result)) {
+	die("$argv[1]: Nieznany resultat \"$result_name\"\n");
+}
 else $result_id = $result[$result_name];
 
 $spec_name = $matches[3];
-if ($spec_name == '') exit;
+if ($spec_name == '') {
+	die("$argv[1]: Brak nazwy speca.\n");
+}
 
 $spec_name = addslashes($spec_name);
 $size = filesize($argv[1]);
@@ -59,6 +70,8 @@
 } else {
 	$query = "INSERT INTO logs(arch_id, result, size, mtime, spec) VALUES($arch_id, $result_id, $size, $mtime, '$spec_name')";
 }
-echo "$query\n";
+//echo "$query\n";
+$dbh->beginTransaction();
 $dbh->exec("$query");
+$dbh->commit();
 ?>
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/PLD-doc/PLD_www_res/buildlogs.sql/addlog.php?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list