PLD-doc: PLD_www_res/buildlogs.sql/index.php - added the gzip comp...

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


Author: witekfl                      Date: Sat Nov 24 11:10:50 2007 GMT
Module: PLD-doc                       Tag: HEAD
---- Log message:
- added the gzip compression
- fixed some minor bugs
- added the configuration file buildlogs.inc

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

---- Diffs:

================================================================
Index: PLD-doc/PLD_www_res/buildlogs.sql/index.php
diff -u PLD-doc/PLD_www_res/buildlogs.sql/index.php:1.2 PLD-doc/PLD_www_res/buildlogs.sql/index.php:1.3
--- PLD-doc/PLD_www_res/buildlogs.sql/index.php:1.2	Sun Nov 18 11:00:17 2007
+++ PLD-doc/PLD_www_res/buildlogs.sql/index.php	Sat Nov 24 12:10:45 2007
@@ -1,9 +1,9 @@
 <?php
-ob_start("ob_gzhandler");
+ob_start("ob_gzhandler", 1);
 $buildlogs_server = "buildlogs.pld-linux.org";
 $url = "index.php";
 $addr = array(
-	"",
+	"", /* must be first */
 	"th/SRPMS",
 	"th/i486",
 	"th/i686",
@@ -37,6 +37,7 @@
 );
 $fail_or_ok = array( "FAIL", "OK" );
 $qa_addr = array(
+	"", /* must be first */
 	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
 	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i486.txt",
 	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-i686.txt",
@@ -72,6 +73,10 @@
 
 $local = 1; /* $local=0 for FTP */ 
 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
+
+// $database and $root_directory are taken from buildlogs.inc
+include_once('buildlogs.inc');
+
 $ftp_conn = 0;
 /* It should be set */
 
@@ -124,9 +129,11 @@
 if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
 else $ns="";
 if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
+else $cnt = 50;
 if (isset($_GET["action"]))$action=$_GET["action"];
 else $action="";
 if (isset($_GET["off"]))$off=(int)$_GET["off"];
+else $off = 0;
 if (isset($_GET["id"]))$id=$_GET["id"];
 if (isset($_GET["log"]))$log=(int)$_GET["log"];
 
@@ -343,10 +350,10 @@
 	}
 */
 	if ($ns != 1) $ns = 0;
-	if (!isset($idx)) $idx = 0;
+	if (!isset($idx)) $idx = 1;
 	if (!isset($ok)) $ok = 0;
-	if (!isset($off)) $off = 0;
-	if (!isset($cnt)) $cnt = 50;
+//	if (!isset($off)) $off = 0;
+//	if (!isset($cnt)) $cnt = 50;
 	if ($ns == 0) $order = "mtime DESC";
 	else $order = "spec";
 
@@ -455,7 +462,7 @@
 
 function file_name_log($l)
 {
-	global $database, $addr, $fail_or_ok;
+	global $database, $addr, $fail_or_ok, $idx, $ok;
 	try {
 		$dbh = new PDO($database);
 	} catch (PDOException $e) {
@@ -464,6 +471,8 @@
 	$f = false;
 	foreach ($dbh->query("SELECT arch_id, result, spec FROM logs WHERE log_id = $l LIMIT 1") as $row) {
 		$f = $addr[$row["arch_id"]] . "/" . $fail_or_ok[$row["result"]] . "/" . $row["spec"] . ".bz2";
+		$idx = $row["arch_id"]; /* for rpmqa */
+		$ok = $row["result"]; /* for status */
 	}
 	return $f;
 }
@@ -547,7 +556,7 @@
 	if ($tail) {
 		one_item(_("full text"), 
 	        	 href(isset($log) ? "$url?log=$log" : "$bu&amp;id=$id",
-			      "View!"));
+			      _("View!")));
 	}
 
 	if ($qa_addr[$idx] != "") {
@@ -816,25 +825,32 @@
        "e.checked = document.forms[0].all.checked;\n".
        "}\n }\n -->\n </script>\n";
 
+/* Shut up warnings */
+  if (!isset($_POST["name"])) $_POST["name"] = "";
+  if (!isset($_POST["age1"])) $_POST["age1"] = "";
+  if (!isset($_POST["age2"])) $_POST["age2"] = "";
+  if (!isset($_POST["size1"])) $_POST["size1"] = "";
+  if (!isset($_POST["size2"])) $_POST["size2"] = "";
+
   echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
 
   echo "<div align=\"center\">";
   echo "<table border=\"0\">\n";
   echo "<tr>\n";
   echo "<td>"._("Package name")."</td>\n";
-  echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"".$_POST["name"]."\"/></td>\n";
+  echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"". $_POST["name"] ."\"/></td>\n";
   echo "</tr>\n";
 
   echo "<tr>\n";
   echo "<td>"._("Days")."</td>\n";
-  echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"".$_POST["age1"]."\" /></td>\n";
-  echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"".$_POST["age2"]."\" /></td>\n";
+  echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"age1\" value=\"". $_POST["age1"] ."\" /></td>\n";
+  echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"age2\" value=\"". $_POST["age2"] ."\" /></td>\n";
   echo "</tr>\n";
 
   echo "<tr>\n";
   echo "<td>"._("Size")."</td>\n";
-  echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"".$_POST["size1"]."\" /></td>\n";
-  echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"".$_POST["size2"]."\" /></td>\n";
+  echo "<td>"._("From").": <input type=\"text\" size=\"20\" name=\"size1\" value=\"". $_POST["size1"] ."\" /></td>\n";
+  echo "<td>"._("To").": <input type=\"text\" size=\"20\" name=\"size2\" value=\"". $_POST["size2"] ."\" /></td>\n";
   echo "</tr>\n";
 
   echo "<tr>\n";
@@ -914,8 +930,8 @@
 		}
 	}
 	if ($or == " OR ") $query .= ")";
-	if (!isset($cnt)) $cnt = 50;
-	if (!isset($off)) $off = 0;
+//	if (!isset($cnt)) $cnt = 50;
+//	if (!isset($off)) $off = 0;
 	if (!isset($ns)) $ns = 0;
 	switch ($ns) {
 		case 0:
@@ -951,8 +967,8 @@
 			 "[<a href=\"$big_url&amp;ns=0\">"._("sort")."</a>]</th>".
 			 "</th></tr>";
 		$i = $off;
-		foreach ($result as $row) {
 //		for ($i = $off; $i < $off + $count; $i++) {
+		foreach ($result as $row) {
 			$f = $row["spec"];
 			$t = $now - $row["mtime"];
 			$s = $row["size"];
================================================================

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



More information about the pld-cvs-commit mailing list