PLD-doc: PLD_www_res/buildlogs.sql/addlog.php (NEW), PLD_www_res/b...

witekfl witekfl at pld-linux.org
Tue Oct 3 20:32:32 CEST 2006


Author: witekfl                      Date: Tue Oct  3 18:32:32 2006 GMT
Module: PLD-doc                       Tag: HEAD
---- Log message:
- buildlogs engine using MySQL database

---- Files affected:
PLD-doc/PLD_www_res/buildlogs.sql:
   addlog.php (NONE -> 1.1)  (NEW), index.php (NONE -> 1.1)  (NEW), init.sql (NONE -> 1.1)  (NEW), migration.php (NONE -> 1.1)  (NEW), PRZECZYTAJ.TO (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: PLD-doc/PLD_www_res/buildlogs.sql/addlog.php
diff -u /dev/null PLD-doc/PLD_www_res/buildlogs.sql/addlog.php:1.1
--- /dev/null	Tue Oct  3 20:32:32 2006
+++ PLD-doc/PLD_www_res/buildlogs.sql/addlog.php	Tue Oct  3 20:32:27 2006
@@ -0,0 +1,77 @@
+#!/usr/bin/php.cli
+<?php
+$user = 'mysql';
+$password = '';
+$root_directory = '/home/services/ftp/pub/pld-buildlogs';
+// parameter: argv[1] - full path to the log file.
+// Keep in sync with database
+$dist = array("ac" => 1, "th" => 2);
+$result = array("FAIL" => 0, "OK" => 1);
+$arch = array(
+	"th/SRPMS" => 0,
+	"th/i486" => 1,
+	"th/i686" => 2,
+	"th/athlon" => 3,
+	"th/x86_64" => 4,
+	"th/ia64" => 5,
+	"th/alpha" => 6,
+	"th/ppc" => 7,
+	"th/sparc" => 8,
+	"ac/SRPMS" => 9,
+	"ac/i386" => 10,
+	"ac/i586" => 11,
+	"ac/i686" => 12,
+	"ac/athlon" => 13,
+	"ac/amd64" => 14,
+	"ac/alpha" => 15,
+	"ac/ppc" => 16,
+	"ac/sparc" => 17,
+	"ac/sparc64" => 18
+);
+
+
+preg_match("|$root_directory/(.*/.*)/(.*)/(.*)\.bz2|", $argv[1], $matches);
+
+$arch_name = $matches[1];
+if (!array_key_exists($arch_name, $arch)) exit;
+else $arch_id = $arch[$arch_name];
+
+$result_name = $matches[2];
+if (!array_key_exists($result_name, $result)) exit;
+else $result_id = $result[$result_name];
+
+$spec_name = $matches[3];
+if ($spec_name == '') exit;
+
+$spec_name = mysql_escape_string($spec_name);
+$size = filesize($argv[1]);
+$mtime = filemtime($argv[1]);
+
+mysql_connect('localhost', "$user", "$password") or die ("connect error" . mysql_error());
+mysql_select_db("buildlogs");
+$row = mysql_query("SELECT spec_id FROM specs WHERE spec='$spec_name' LIMIT 1") or die("SELECT 1" . mysql_error());
+if (mysql_num_rows($row) == 0) {
+	mysql_query("INSERT INTO specs(spec) VALUES ('$spec_name')") or die("INSERT 1" . mysql_error());
+	$row = mysql_query("SELECT spec_id FROM specs WHERE spec='$spec_name' LIMIT 1") or die("SELECT 1" . mysql_error());
+	if (mysql_num_rows($row) == 0) {
+		mysql_close($link);
+		exit;
+	}
+}
+$linia = mysql_fetch_object($row);
+$spec_id = $linia->spec_id;
+mysql_free_result($row);
+
+$row = mysql_query("SELECT log_id FROM logs WHERE spec_id=$spec_id AND arch_id=$arch_id LIMIT 1");
+if (mysql_num_rows($row) == 0) {
+	mysql_query("INSERT INTO logs(arch_id, spec_id, result, size, mtime) "
+	. "VALUES ($arch_id, $spec_id, $result_id, $size, $mtime)") or die("INSERT 2" . mysql_error());
+} else {
+	$linia = mysql_fetch_object($row);
+	mysql_query("UPDATE logs SET result = $result_id, size = $size, mtime = $mtime WHERE log_id = $linia->log_id")
+	or die ("UPDATE" . mysql_error());
+}
+mysql_free_result($row);
+mysql_close();
+echo "OK $linia->log_id $argv[1]\n";
+?>

================================================================
Index: PLD-doc/PLD_www_res/buildlogs.sql/index.php
diff -u /dev/null PLD-doc/PLD_www_res/buildlogs.sql/index.php:1.1
--- /dev/null	Tue Oct  3 20:32:32 2006
+++ PLD-doc/PLD_www_res/buildlogs.sql/index.php	Tue Oct  3 20:32:27 2006
@@ -0,0 +1,1095 @@
+<?php
+$buildlogs_server = "buildlogs.pld-linux.org";
+$url = "index.php";
+$addr = array(
+	"th/SRPMS",
+	"th/i486",
+	"th/i686",
+	"th/athlon",
+	"th/x86_64",
+	"th/ia64",
+	"th/alpha",	
+	"th/ppc",
+	"th/sparc",
+	"ac/SRPMS",
+	"ac/i386",
+	"ac/i586",
+	"ac/i686",
+	"ac/athlon",
+	"ac/amd64",
+	"ac/alpha",	
+	"ac/ppc",
+	"ac/sparc",
+	"ac/sparc64"/*,
+	"/ra/i386",
+	"/ra/i586",
+	"/ra/i686",
+	"/ra/alpha",	
+	"/ra/ppc",
+	"/ra/sparc",
+	"/nest/i486",
+	"/nest/i686",
+	"/nest/alpha",
+	"/nest/ppc"
+*/
+);
+$qa_addr = array(
+	"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",
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-athlon.txt",
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-x86_64.txt",
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ia64.txt",
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-alpha.txt",	
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-ppc.txt",
+	"http://ftp.pld-linux.org/dists/th/.stat/builder/th/rpmqa-sparc.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-SRPMS.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i386.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i586.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-i686.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-athlon.txt",
+	"http://ftp.pld-linux.org/dists/ac/.stat/builder/ac/rpmqa-amd64.txt",
+	"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/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",
+	"http://ftp.pld-linux.org/dists/ra/.stat/builder/fly/rpmqa-ra-alpha.txt",	
+	"http://ftp.pld-linux.org/dists/ra/.stat/builder/an2/rpmqa-ra-ppc.txt",
+	"http://ftp.pld-linux.org/dists/ra/.stat/builder/ares/rpmqa-ra-sparc.txt",
+	"http://ftp.nest.pld-linux.org/.stat/builder/kenny/rpmqa-nest-i486.txt",
+	"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";
+$ftp_conn = 0;
+/* It should be set */
+
+$langs["en_US"]["charset"]="ISO-8859-1";
+$langs["pl_PL"]["charset"]="ISO-8859-2";
+
+$lang="en_US";
+if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
+{
+  $rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+  $rows=explode(",",$rows[0]);
+  $lang_detected=rtrim($rows[0]);
+} else if (preg_match("/opera/i",$_SERVER["HTTP_USER_AGENT"]))
+{
+  $lang_detected=preg_replace("/.*\[(.*)\].*/i","\\1",$_SERVER["HTTP_USER_AGENT"]);
+}
+
+// FIXME - some array
+$lang_detected=preg_replace("/^pl$/i","pl_PL",$lang_detected);
+
+if (isset($lang_detected) && isset($langs[$lang_detected]))
+{
+  $lang=$lang_detected;
+}
+
+if (isset($_GET["lang"]))$_SESSION["lang"]=$_GET["lang"];
+if (isset($_SESSION["lang"]))$lang=$_SESSION["lang"];
+
+putenv("LANG=$lang");
+setlocale(LC_ALL,$lang);
+bindtextdomain("messages","locale");
+textdomain("messages");
+
+if (isset($_GET["idx"]))$idx=(int)$_GET["idx"];
+if (isset($_GET["dist"]))
+{
+	$dist=$_GET["dist"];
+	if (isset($_GET["arch"]))
+	{
+		$arch=$_GET["arch"];
+		for ($i = 0; $i < count($addr); $i++)
+		{
+			if ($addr[$i]==$dist."/".$arch)
+				$idx=$i;
+		}
+	}
+}
+if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
+else $ok="";
+if (isset($_GET["ns"]))$ns=(int)$_GET["ns"];
+else $ns="";
+if (isset($_GET["cnt"]))$cnt=(int)$_GET["cnt"];
+if (isset($_GET["action"]))$action=$_GET["action"];
+else $action="";
+if (isset($_GET["off"]))$off=(int)$_GET["off"];
+if (isset($_GET["id"]))$id=$_GET["id"];
+if (isset($_GET["log"]))$log=(int)$_GET["log"];
+
+if (isset($_POST["str"]))$str=$_POST["str"];
+if (isset($_POST["idx"]))$idx=$_POST["idx"];
+if (isset($_POST["action"]))$action=$_POST["action"];
+
+function myheader()
+{
+echo '<' . '?xml version="1.0" encoding="' . _("ISO-8859-1") .'"?' . ">\n";
+echo '<' . '?xml-stylesheet href="#internalStyle" type="text/css"?' . ">\n";
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>PLD Build Logs</title>
+  <?php echo '<meta http-equiv="Content-type" content="text/html; charset=' . _("ISO-8859-1") .'"/>' ."\n";?>
+  <style type="text/css"><!--
+A { text-decoration: none; }
+A:hover { text-decoration: underline; }
+H1 { font-family: arial,helvetica,sans-serif; 
+     font-size: 20pt; 
+     font-weight: bold;}
+H2 { font-family: arial,helvetica,sans-serif; 
+     font-size: 18pt; 
+     font-weight: bold;}
+BODY,TD { font-family: arial,helvetica,sans-serif; 
+          font-size: 13pt; }
+TH { font-family: arial,helvetica,sans-serif; 
+     font-size: 13pt; 
+     font-weight: bold; }
+//-->
+</style>
+ </head>
+ <!-- Diffrent color for visited link doesn't make much sense here...
+      this page is autogenerated and it might be misleading after some
+      build log changes. -->
+ <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
+<?php
+}
+
+function start_pre()
+{
+	echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
+		"<font color=\"#cccccc\"><pre style=\"width: 2048px;overflow: scroll\">";
+}
+
+function end_pre()
+{
+	echo "</pre></font></td></tr></table>\n";
+}
+
+function trailer()
+{
+	echo "</body></html>";
+}
+
+
+function mydie($msg)
+{
+	echo "Fatal error: $msg";
+}
+
+function open_ftp($pidx="", $pok="")
+{
+	global $idx, $addr, $buildlogs_server, $ok;
+	global $ftp_conn, $big_url, $url, $ns;
+	global $off, $cnt;
+	
+	if ($pidx==="")$pidx=$idx;
+	if ($pok==="")$pok=$ok;
+
+	if (!isset($pidx) || !isset($addr[$pidx]))
+		return false;
+
+	if ($pok != 1)
+		$pok = 0;
+	if ($ns != 1)
+		$ns = 0;
+
+	if ($pok == 1) {
+		$a = "$addr[$pidx]/OK";
+	} else {
+		$a = "$addr[$pidx]/FAIL";
+	}
+
+	if (!isset($off))
+		$off = 0;
+	if (!isset($cnt))
+		$cnt = 16;
+
+	$big_url = "$url?idx=$idx&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
+
+	$ftp = ftp_connect($buildlogs_server);
+
+	if ($ftp == false) {
+		mydie(_("cannot connect to")." $buildlogs_server");
+		return false;
+	}
+
+	if (ftp_login($ftp, "anonymous", 
+		      "buildlogs-iface at pld-linux.org") == false) {
+		ftp_quit($ftp);
+		mydie(_("cannot ftp login to")." $buildlogs_server");
+		return false;
+	}
+
+	$list = ftp_nlist($ftp, $a);
+	if ($list == false) {
+		ftp_quit($ftp);
+		mydie(_("cannot list")." $a");
+		return false;
+	}
+
+	$ftp_conn = $ftp;
+
+	return $list;
+}
+
+function directory_list($pidx="",$pok="")
+{
+	global $idx, $addr, $buildlogs_server, $ok;
+	global $root_directory, $big_url, $url, $ns;
+	global $off, $cnt;
+
+	if ($pidx==="")$pidx=$idx;
+	if ($pok==="")$pok=$ok;
+	if (!isset($pidx) || !isset($addr[$pidx]))
+		return false;
+
+	if ($pok != 1)
+		$pok = 0;
+	if ($ns != 1)
+		$ns = 0;
+
+	if ($pok == 1) {
+		$a = "$addr[$pidx]/OK";
+	} else {
+		$a = "$addr[$pidx]/FAIL";
+	}
+
+	if (!isset($off))
+		$off = 0;
+	if (!isset($cnt))
+		$cnt = 16;
+
+	$big_url = "$url?idx=$idx&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
+
+	$dir = opendir("$root_directory/$a");
+	$i = 0;
+	$list = array ();
+	while ($file = readdir($dir)) {
+		if (($file != ".") && ($file != "..")) {
+			$list[$i] = array("$a/$file", filemtime("$root_directory/$a/$file"));
+			$i++;
+		}
+	}
+	closedir($dir);
+	return $list;
+}
+
+function list_logs()
+{
+	global $idx, $addr, $ok;
+	global $ftp_conn, $big_url, $ns, $qa_addr;
+	global $off, $cnt, $local, $root_directory, $url;
+/*
+	if ($local) {
+		$list = directory_list();
+	} else {
+		$list = open_ftp();
+	}
+	if ($list == false)
+		return;
+*/
+	$big_url = "$url?idx=$idx&amp;ok=$ok&amp;ns=$ns&amp;cnt=$cnt";
+
+	if ($ok == 1) {
+		echo "<h1>"._("Listing of")." $addr[$idx]/OK "
+			."(<a href=\"$big_url&amp;ok=0\">"._("fail")."</a>)</h1>\n";
+	} else {
+		echo "<h1>"._("Listing of")." $addr[$idx]/FAIL "
+			."(<a href=\"$big_url&amp;ok=1\">"._("ok")."</a>)</h1>\n";
+	}
+
+	echo "<div align=\"center\"><table cols=\"4\" border=\"0\" cellspacing=\"1\" ".
+		"cellpadding=\"3\" bgcolor=\"#000000\" width=\"90%\">\n";
+	echo "<tr><th bgcolor=\"#CCCCFF\" align=\"right\" width=\"1%\">"._("No.")."</th>".
+		 "<th bgcolor=\"#CCCCFF\" align=\"left\" width=\"80%\">"._("Log File").
+			"[<a href=\"$big_url&amp;ns=1\">"._("sort")."</a>]</th>".
+		 "<th bgcolor=\"#CCCCFF\" align=\"right\" width=\"15%\">"._("Size")."</th> ".
+		 "<th bgcolor=\"#CCCCFF\" align=\"left\">"._("Age").
+			 "[<a href=\"$big_url&amp;ns=0\">"._("sort")."</a>]</th>".
+		 "</tr>";
+/*
+	function cmp($f1, $f2) {
+		global $ftp_conn, $root_directory, $local;
+		if ($local)
+			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 {
+		usort($list, "cmp2");
+	}
+*/
+	if ($ns != 1) $ns = 0;
+	if (!isset($idx)) $idx = 0;
+	if (!isset($ok)) $ok = 0;
+	if (!isset($off)) $off = 0;
+	if (!isset($cnt)) $cnt = 50;
+	if ($ns == 0) $order = "logs.mtime DESC";
+	else $order = "specs.spec";
+
+	$query = "SELECT specs.spec, logs.log_id, logs.mtime, logs.size FROM specs, logs WHERE "
+	. "specs.spec_id = logs.spec_id AND logs.arch_id = $idx AND logs.result = $ok ORDER BY $order LIMIT $cnt OFFSET $off";
+
+	mysql_connect("localhost", "mysql", "") or die(mysql_error());
+	mysql_select_db("buildlogs") or die(mysql_error()); 
+	$result = mysql_query("$query") or die(mysql_error());
+	$count = mysql_num_rows($result);
+
+	$now = time();
+	for ($i = $off; $i < $count + $off; $i++) {
+		$row = mysql_fetch_assoc($result);
+		$f = $row["spec"];
+		$t = $now - $row["mtime"];
+		$s = $row["size"];
+		$h = $row["log_id"];
+/*		
+		if (!isset($filename))
+			continue;
+		$h = bin2hex(mhash(MHASH_MD5, $filename));
+		$f = preg_replace("/.*\/([^\/]*)$/", "\\1", $filename);
+		$f = preg_replace("/\.(bz2|gz)$/", "", $f);
+		if ($local) {
+			$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]);
+		}
+*/
+		$t /= 60;
+		if ($t >= 60) {
+			$t /= 60;
+			if ($t >= 24) {
+				$t /= 24;
+				$t = round($t);
+				$t = $t . "&nbsp;" . ngettext("day","days",$t);
+			} else {
+				$t = round($t);
+				$t = $t . "&nbsp;" . ngettext("hour","hours",$t);
+			}
+		} else {
+			$t = round($t);
+			$t = $t . "&nbsp;" . ngettext("minute","minutes",$t);
+		}
+//		$u = "$big_url&amp;off=$off&amp;id=$h";
+		$u = "$url?log=$h";
+		echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
+		     "<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
+		     "[<a href=\"$u&amp;action=text\">"._("text")."</a> | ".
+		      "<a href=\"$u&amp;action=tail\">"._("tail")."</a>]".
+		     "</td><td bgcolor=\"#CCCCCC\" align=\"right\">".
+		     "$s</td><td bgcolor=\"#CCCCCC\">$t</td></tr>\n";
+	}
+	echo "</table></div>\n";
+
+	$backarr = "&lt;&lt;&lt;&nbsp;";
+	$back = _("Page back");
+	$forward = _("Page forward");
+	$forwardarr = "&nbsp;&gt;&gt;&gt;";
+
+	echo "<p><table width=\"90%\" align=\"center\"><tr><td align=\"left\" width=\"1%\">";
+
+	if ($off > 0) {
+		$noff = $off - $count;
+		if ($noff < 0)	
+			$noff = 0;
+		$hrefurl = "<a href=\"$big_url&amp;off=$noff\">";
+		echo "$hrefurl$backarr</a></td><td align=\"left\">$hrefurl$back</a>";
+	} else {
+		echo "$backarr</td><td align=\"left\">$back";
+	}
+
+	echo "</td>\n<td align=\"center\">";
+
+	if ($qa_addr[$idx] != "") {
+		echo "[<a href=\"$big_url&amp;action=qa\">"._("View <quot>rpm&nbsp;-qa</quot> of builder")."</a>]";
+	} else {
+		echo "&nbsp;";
+	}
+
+	echo "</td>\n<td align=right>";
+//	if ($off + $cnt < count($list)) {
+	if ($cnt == $count) {
+		$noff = $off + $cnt;
+		if ($noff < 0)	
+			$noff = 0;
+		$hrefurl = "<a href=\"$big_url&amp;off=$noff\">";
+		echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
+	} else {
+		echo "$forward</td><td align=right width=1%>$forwardarr";
+	}
+	echo "</td>\n</tr></table></p>";
+	mysql_free_result($result);
+	mysql_close();
+//	if ($local == 0) {
+//		ftp_quit($ftp_conn);
+//		$ftp_conn = 0;
+//	}
+}
+
+function file_name_log($l)
+{
+	mysql_connect("localhost", "mysql", "") or die(mysql_error());
+	mysql_select_db("buildlogs") or die(mysql_error());
+	$query = "SELECT a.name, result.name as res, specs.spec FROM specs, architectures a, result, logs WHERE "
+	. "logs.log_id = $l AND specs.spec_id = logs.spec_id AND a.arch_id = logs.arch_id AND "
+	. "result.result_id = logs.result LIMIT 1";
+	$result = mysql_query($query) or die(mysql_error());
+	if (mysql_num_rows($result) == 1) {
+		$row = mysql_fetch_assoc($result);
+		$f = $row["name"] . "/" . $row["res"] . "/" . $row["spec"] . ".bz2";
+	} else {
+		$f = false;
+	}
+	mysql_free_result($result);
+	mysql_close();
+	return $f;
+}
+
+function file_name()
+{
+	global $idx, $addr, $ok;
+	global $ftp_conn, $root_directory, $big_url, $ns, $id;
+	global $buildlogs_server, $local, $log;
+
+	if (isset($log)) return file_name_log($log);
+	if (!isset($id))
+		return false;
+	if ($local) {
+		$list = directory_list();
+	} else {
+		$list = open_ftp();
+	}
+	if ($list == false)
+		return false;
+
+	$f = false;
+	for ($i = 0; $i < count($list); $i++) {
+		$h = bin2hex(mhash(MHASH_MD5, $list[$i][0]));
+		if ($h == $id) {
+			$f = $list[$i][0];
+			break;
+		}
+	}
+
+	if ($f == false) {
+		mydie(_("cannot find specified file:")." $id");
+		if ($local == 0)
+			ftp_quit($ftp_conn);
+		return false;
+	}
+
+	return $f;
+}
+
+function dump_log($tail)
+{
+	global $idx, $addr, $ok, $url;
+	global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
+	global $buildlogs_server, $local, $qa_addr, $log;
+
+	$f = file_name();
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list