|
|||
Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").
linksdecay & ruin got that wrong appropriate tech fun social media stuff Like asecular.com (nobody does!) Like my brownhouse: |
automatically quantifying the pace of change Thursday, October 11 2007
function DetermineVersion() { //comes back with a version numbers for admin scripts based on mod dates //the base version is set as the first items in $versionconfig, corresponding //to the timestamp of the mod date, the second items //this base is added to the results of some wacky math designed to keep //the calculated version after that base timestamp low. //the result versions (to be added to the base) tend to be smaller than "0.001" //unless the file is very much beyond the base timestamp for that version. //this system will automatically scan through the list //of files given in the ddl called $strConfig, //labeling them with the second fields in that ddl. $strClassFirst="bgclassfirst"; $strClassSecond="bgclasssecond"; $strConfig="tableform.php|Tableform-admin_functions.php| Core function library-tableform_js.js| Core javascript library-tablemaker.php| Tablemaker-tablemaker_js.js|Tablemaker javascript-saveform.php| Tableform saver library-dbtools.php| Database tools-dump.php|CSV tools-backup_functions.php| Backup functions-frontenddbfunctions.php| Frontend db functions-genericuserfunctions.php| Generic user functions"; $versionconfig="0.5|1182650153-1|1191945058"; $date=filemtime("admin_functions.php"); $datearray=getdate($date); $thisyear=$datearray["year"]; $previousversion="0.5"; $arrVersions=explode("-", $versionconfig); $thismonth=str_pad($datearray["month"], 2, "0", STR_PAD_LEFT); $thisday=str_pad($datearray["mday"], 2, "0", STR_PAD_LEFT); $out=""; $out.="<table cellpadding=\"0\" cellspacing=\"1\" "; $out.="border=\"0\" width=\"450\" class=\"bgclassline\">\n"; $out.="<tr><td class=\"heading\" colspan=\"2\">"; $out.="Tableform Database Tool</td></tr>\n"; $arrConfig=explode("-", $strConfig); foreach($arrConfig as $thisConfig) { $arrData=explode("|", $thisConfig); $strFile=$arrData[0]; $strThisBgClass=Alternate($strClassFirst, $strClassSecond, $strThisBgClass); $out.="<tr class=\"" . $strThisBgClass . "\"><td>"; if (file_exists($strFile)) { $moddate=filemtime($strFile); for($i=0; $i<count($arrVersions); $i++) { $thisversion=$arrVersions[$i]; $bwlWeHaveAnother=false; if($i<count($arrVersions)-1) { $arrnextVersionData= explode("|", $arrVersions[$i+1]); $bwlWeHaveAnother=true; } //echo $thisversion . "--<br>"; $arrVersionData=explode("|", $thisversion); if($bwlWeHaveAnother) { //echo "*<br>"; if (intval($arrVersionData[1])<intval($moddate) && intval($arrnextVersionData[1])> intval($moddate)) { $baseversion=$arrVersionData[0]; $basemoddate=$arrVersionData[1]; //echo $basemoddate . "++<br>"; break; } } else { if (intval($arrVersionData[1])< ;intval($moddate)) { $baseversion=$arrVersionData[0]; $basemoddate=$arrVersionData[1]; break; //echo $basemoddate . "&&<br>"; } else { $baseversion=0; $basemoddate=1000650153; break; } } } $version= $baseversion + pow(($moddate - $basemoddate)/100000000000,.5); $out.= $arrData[1] . "</td><td> version: " . NanHandler(substr($version, 0, 8) , $previousversion);// . " " . $moddate; } else { $out.= $arrData[1] . "</td><td>not present" ; } $out.="</td></tr>\n"; } $out.="</table>\n<p/><br>"; return $out; } For linking purposes this article's URL is: previous | next |