blob: ef5347293e6be5b515ae26340a764496ced459a2 [file] [log] [blame]
<?php
$buildBranches = array();
$buildBranches[0]="R3.0";
$buildBranches[1]="R2.0";
$buildBranches[2]="R1.5";
$buildBranches[3]="R1.0";
$buildBranches[4]="R0.7";
include 'report.php';
include 'report2.php';
$latestTimeStamp=array();
$latestFile = array();
$buckets = array();
$timeStamps = array();
function computeMainData($buildBranches, $debugScript)
{
global $buckets, $latestFile, $latestTimeStamp, $timeStamps;
foreach ($buildBranches as $buildBranch ) {
$aBranchDirectoryName = "drops/".$buildBranch;
if (file_exists($aBranchDirectoryName) && is_dir($aBranchDirectoryName)) {
$aDirectory = dir($aBranchDirectoryName);
$latestTimeStamp[$buildBranch] = array();
$latestFile[$buildBranch] = array();
while (false !== ($anEntry = $aDirectory->read())) {
// Short cut because we know aDirectory only contains other directories.
if ($anEntry != "." && $anEntry!="..") {
// echo "Debug anEntry: $anEntry<br />" ;
$aDropDirectoryName = "drops/".$buildBranch."/".$anEntry;
if (is_dir($aDropDirectoryName) && is_Readable($aDropDirectoryName)) {
$aDropDirectory = dir($aDropDirectoryName);
//echo "Debug aDropDirectory: $aDropDirectory->path <br />" ;
$fileCount = 0;
while ($aDropEntry = $aDropDirectory->read()) {
// echo "Debug aDropEntry: $aDropEntry<br />" ;
if ( (stristr($aDropEntry, ".tar.gz")) || (stristr($aDropEntry, ".zip")) ) {
// Count the dropfile entry in the directory (so we won't display links, if not all there
$fileCount = $fileCount + 1;
}
}
$aDropDirectory->close();
}
// Read the count file
$countFile = "drops/".$buildBranch."/".$anEntry."/files.count";
$indexFile = "drops/".$buildBranch."/".$anEntry."/index.html";
if (!file_exists($indexFile)) {
$indexFile = "drops/".$buildBranch."/".$anEntry."/index.php";
}
if (file_exists($countFile) && file_exists($indexFile)) {
$anArray = file($countFile);
// debug
//echo "Number according to files.count: ", $anArray[0];
//echo " actual counted files: ", $fileCount;
// If a match - process the directoryVV -- we simply look that there's more
// zip's than we expect, since it frequently breaks where the count is slighly
// off, such as when we add, after the fact, an all-in-one zip.
if ($anArray[0] <= $fileCount) {
// debug
//echo "yes, counted equaled expected count<br />";
$entryParts = explode("-", $anEntry);
if (count($entryParts) == 3) {
// debug
//echo "yes, counted parts was 3<br />";
$buildTypePart = $entryParts[0];
$buckets[$buildBranch][$buildTypePart][] = $anEntry;
if ($debugScript) {
echo "Found: $buildBranch, $buildTypePart, $anEntry <br />";
}
$timePart = $entryParts[2];
$year = substr($timePart, 0, 4);
$month = substr($timePart, 4, 2);
$day = substr($timePart, 6, 2);
$hour = substr($timePart,8,2);
$minute = substr($timePart,10,2);
$newTimePart = "$year-$month-$day $hour:$minute UTC";
$timeStamp = strtotime($newTimePart);
$timeStamps[$anEntry] = gmdate("D, j M Y -- H:i \(\U\T\C\)", $timeStamp);
// debug
// echo "<br />buildBranch: $buildBranch <br />";
// echo "<br />parts[0]: -$buildTypePart- <br />";
// echo "latestTimeStamp[buildBranch]:";
// echo $latestTimeStamp[$buildBranch];
// echo "latestTimeStamp:";
// echo $latestTimeStamp;
if ((sizeof($latestTimeStamp[$buildBranch]) > 0) &&
(isset($latestTimeStamp[$buildBranch][$buildTypePart])))
{
if ($timeStamp > $latestTimeStamp[$buildBranch][$buildTypePart])
{
$latestTimeStamp[$buildBranch][$buildTypePart] = $timeStamp;
$latestFile[$buildBranch][$buildTypePart] = $anEntry;
}
}
else
{
$latestTimeStamp[$buildBranch][$buildTypePart] = $timeStamp;
$latestFile[$buildBranch][$buildTypePart] = $anEntry;
}
}
}
}
}
}
$aDirectory->close();
}}
}
?>