PLD-doc: PLD_www_res/buildlogs/index.php - filemtime info cached (...

witekfl witekfl at pld-linux.org
Fri Sep 15 20:16:42 CEST 2006


Author: witekfl                      Date: Fri Sep 15 18:16:42 2006 GMT
Module: PLD-doc                       Tag: HEAD
---- Log message:
- filemtime info cached (speedup)
- commented out outdated ac and ra logs

---- Files affected:
PLD-doc/PLD_www_res/buildlogs:
   index.php (1.87 -> 1.88) 

---- Diffs:

================================================================
Index: PLD-doc/PLD_www_res/buildlogs/index.php
diff -u PLD-doc/PLD_www_res/buildlogs/index.php:1.87 PLD-doc/PLD_www_res/buildlogs/index.php:1.88
--- PLD-doc/PLD_www_res/buildlogs/index.php:1.87	Sat Jan 28 21:59:43 2006
+++ PLD-doc/PLD_www_res/buildlogs/index.php	Fri Sep 15 20:16:37 2006
@@ -20,7 +20,7 @@
 	"/ac/alpha",	
 	"/ac/ppc",
 	"/ac/sparc",
-	"/ac/sparc64",
+	"/ac/sparc64"/*,
 	"/ra/i386",
 	"/ra/i586",
 	"/ra/i686",
@@ -31,6 +31,7 @@
 	"/nest/i686",
 	"/nest/alpha",
 	"/nest/ppc"
+*/
 );
 $qa_addr = array(
 	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-SRPMS.txt",
@@ -51,7 +52,7 @@
 	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-alpha.txt",	
 	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-ppc.txt",
 	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc.txt",
-	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc64.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-sparc64.txt"/*,
 	"http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i386.txt",
 	"http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i586.txt",
 	"http://ftp.pld-linux.org/dists/ra/.stat/builder/liniowiec/rpmqa-ra-i686.txt",
@@ -62,6 +63,7 @@
 	"http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i686.txt",
 	"http://ftp.nest.pld-linux.org/.stat/builder/alpha/rpmqa-nest-alpha.txt",
 	"http://ftp.nest.pld-linux.org/.stat/builder/an2/rpmqa-nest-ppc.txt"
+*/
 );
 $local = 1; /* $local=0 for FTP */ 
 $root_directory = "/home/services/ftp/pub/pld-buildlogs";
@@ -273,7 +275,7 @@
 	$list = array ();
 	while ($file = readdir($dir)) {
 		if (($file != ".") && ($file != "..")) {
-			$list[$i] = "$a/$file";
+			$list[$i] = array("$a/$file", filemtime("$root_directory$a/$file"));
 			$i++;
 		}
 	}
@@ -316,27 +318,32 @@
 	function cmp($f1, $f2) {
 		global $ftp_conn, $root_directory, $local;
 		if ($local)
-			return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
+			return $f2[1] - $f1[1];//filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
 		return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
 	}
 
+	function cmp2($f1, $f2) {
+		return strcmp($f1[0], $f2[0]);
+	}
+
 	if ($ns != 1) {
 		$ns = 0;
 		usort($list, "cmp");
 	} else {
-		sort($list);
+		usort($list, "cmp2");
 	}
 
 	$now = time();
 	for ($i = $off; $i < $cnt + $off; $i++) {
-		if (!isset($list[$i]))
+		$filename = $list[$i][0];
+		if (!isset($filename))
 			continue;
-		$h = bin2hex(mhash(MHASH_MD5, $list[$i]));
-		$f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
+		$h = bin2hex(mhash(MHASH_MD5, $filename));
+		$f = preg_replace("/.*\/([^\/]*)$/", "\\1", $filename);
 		$f = preg_replace("/\.(bz2|gz)$/", "", $f);
 		if ($local) {
-			$s = filesize("$root_directory$list[$i]");
-			$t = $now - filemtime("$root_directory$list[$i]");
+			$s = filesize("$root_directory$filename");
+			$t = $now - $list[$i][1];
 		} else {
 			$s = ftp_size($ftp_conn, $list[$i]);
 			$t = $now - ftp_mdtm($ftp_conn, $list[$i]);
@@ -426,9 +433,9 @@
 
 	$f = false;
 	for ($i = 0; $i < count($list); $i++) {
-		$h = bin2hex(mhash(MHASH_MD5, $list[$i]));
+		$h = bin2hex(mhash(MHASH_MD5, $list[$i][0]));
 		if ($h == $id) {
-			$f = $list[$i];
+			$f = $list[$i][0];
 		}
 	}
 
@@ -817,10 +824,10 @@
 	    {
 	      while (list($k,$name)=each($tmp_list))
 	      {
-		$s = filesize("$root_directory$name");
-		$t = $now - filemtime("$root_directory$name");
+		$s = filesize("$root_directory$name[0]");
+		$t = $now - $name[1];
 		$t/=(24*3600);
-		if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name)))continue;
+		if (($_POST["name"]!="") && (!preg_match("/".$_POST["name"]."/i",$name[0])))continue;
 		if (($_POST["age1"]) && ($_POST["age1"]>$t))continue;
 		if (($_POST["age2"]) && ($_POST["age2"]<$t))continue;
 
@@ -853,14 +860,14 @@
 	function cmp1($f1, $f2) {
 		global $ftp_conn, $root_directory, $local;
 		if ($local)
-			return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
+			return $f2[1] - $f1[1];
 		return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
 	}
 
 	function cmp2($f1, $f2) {
-	  list($p11,$p12,$p13)=explode("_",$f1);
-	  list($p21,$p22,$p23)=explode("_",$f2);
-	  return strcmp($f2,$f1);
+	  list($p11,$p12,$p13)=explode("_",$f1[0]);
+	  list($p21,$p22,$p23)=explode("_",$f2[0]);
+	  return strcmp($f1[0],$f2[0]);
 	}
 
 	if ($ns == 1)
@@ -885,13 +892,14 @@
 
   	  $counter++;
 	  list($i,$j,$k)=explode("_",$k);
+	  $filename = $name[0];
 
-		$h = bin2hex(mhash(MHASH_MD5, $name));
-		$f = preg_replace("/.*\/([^\/]*)$/", "\\1", $name);
+		$h = bin2hex(mhash(MHASH_MD5, $filename));
+		$f = preg_replace("/.*\/([^\/]*)$/", "\\1", $filename);
 		$f = preg_replace("/\.(bz2|gz)$/", "", $f);
 		if ($local) {
-			$s = filesize("$root_directory$name");
-			$t = $now - filemtime("$root_directory$name");
+			$s = filesize("$root_directory$filename");
+			$t = $now - $name[1];
 		} else {
 			$s = ftp_size($ftp_conn, $list[$i]);
 			$t = $now - ftp_mdtm($ftp_conn, $list[$i]);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/PLD-doc/PLD_www_res/buildlogs/index.php?r1=1.87&r2=1.88&f=u



More information about the pld-cvs-commit mailing list