Hi,
I want to include version information to output generated by XSL
stylesheet. This information is auto-generated for DSSSL stylesheets
into file version.dsl. I modified script used to build this file to
generate same information in XML format. Unfortunatelly I have not
enough karma to commit this back to /repository/functable.
I attached modified file to this e-mail and I hope that someone on list
have enough karma and he will add this file into CVS and will modify
makefile to automaticaly genetates something called like
/repository/phpdoc/version.xml. Then I can customize XSL stylesheets to
generate same output as DSSSL ones.
Thanks.
Jirka
-----------------------------------------------------------------
Jirka Kosek
e-mail: [EMAIL PROTECTED]
http://www.kosek.cz
#!/usr/local/bin/php4 -q
<?
set_time_limit(0);
$min3 = array();
$max3 = array();
$min4 = array();
$max4 = array();
$func = array();
$ver = array();
$db = mysql_connect("localhost","phpdoc","phpdoc");
if(! $db) { echo "kein DB-Server\n"; exit; }
if(! mysql_select_db("phpdoc")) { echo "keine DB\n";exit;}
$result = mysql_query("select distinct version,versionid from funclist");
if(!$result) { echo mysql_error(); exit; }
if(!$result) { echo mysql_error(); exit; }
while ($row=mysql_fetch_array($result)) {
$ver[$row["versionid"]]=str_replace("_",".",str_replace("php_","",$row["version"]));
}
mysql_free_result($result);
$result = mysql_query("select function,min(versionid) as min3,max(versionid) as max3
from funclist where versionid <400 group by function");
if(!$result) { echo mysql_error(); exit; }
while ($row=mysql_fetch_array($result)) {
$func[$row["function"]] = true;
$min3[$row["function"]] = $row["min3"];
$max3[$row["function"]] = $row["max3"];
}
mysql_free_result($result);
$result = mysql_query("select function,min(versionid) as min4,max(versionid) as max4
from funclist where versionid >=400 group by function");
if(!$result) { echo mysql_error(); exit; }
while ($row=mysql_fetch_array($result)) {
$func[$row["function"]] = true;
$min4[$row["function"]] = $row["min4"];
$max4[$row["function"]] = $row["max4"];
}
mysql_free_result($result);
echo "<!-- DO NOT EDIT THIS FILE !!!";
echo ";; as it is auto-generated from the same database";
echo ";; as the functiontable at ";
echo ";; http://www.zugeschaut-und-mitgebaut.de/php";
echo ";; you can generate it yourself by unsing the code";
echo ";; to be found under the functable repository in CVS";
echo ";;";
echo ";; if you think this is out of date :";
echo ";; mailto:[EMAIL PROTECTED]";
echo ";; -->";
echo "<versions>\n";
reset($func);
while(list($key,)=each($func)) {
if(isset($min3[$key])) {
$min = $min3[$key]-300;
$max = $max3[$key]-300;
$ver3="PHP 3";
if($min==0) {
if($max==99) { ; }
else { $ver3.=" <= ".$ver[$max+300];}
} else if($min==99){
$ver3.=" CVS only";
} else {
if($max==99) { $ver3.=">= ".$ver[$min+300]; }
else if ($min==$max) {$ver3.=$ver[$min+300]." only";}
else { $ver3=$ver[$min+300]." - ".$ver[$max+300]." only";}
}
} else {
$ver3 = "";
}
if(isset($min4[$key])) {
$min = $min4[$key]-400;
$max = $max4[$key]-400;
$ver4="PHP 4 ";
if($min==1) {
if($max==99) { ; }
else { $ver4.=" <= ".$ver[$max+400];}
} else if($min==99){
$ver4.=" CVS only";
} else {
if($max==99) { $ver4.=">= ".$ver[$min+400]; }
else if ($min==$max) {$ver4.=$ver[$min+400]." only";}
else { $ver4=$ver[$min+400]." - ".$ver[$max+400]." only";}
}
} else {
$ver4 = "";
}
if(empty($ver3)||empty($ver4)) {
$ver34 = "$ver3$ver4";
} else {
$ver34 = "$ver3, $ver4";
}
echo " <function name=\"$key\" from=\"$ver34\"/>";
}
echo "</versions>\n";
?>