| <?php |
| |
| $debugLatest=false; |
| |
| $latestTimeStamp=array(); |
| $latestFile = array(); |
| |
| echo "<table border=0 cellpadding=2 width=\"100%\"><tr>"; |
| echo "<td align=\"center\" bgcolor=\"#0080C0\"><font color=\"#FFFFFF\" face=\"Arial,Helvetica\">"; |
| echo $mainTableHeader; |
| echo "</font></td>"; |
| echo "</tr></table>"; |
| |
| |
| |
| 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 ($debugLatest) { |
| 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(); |
| }} |
| |
| ?> |
| |
| |
| <table width="70%" align="center" cellpadding=2> |
| <tr> |
| <td width="25%"><b>Build Type</b></td> |
| <td width="25%"><b>Build Name</b></td> |
| <td width="15%"><b>Stream</b></td> |
| <td width="40%"><b>Build Date</b></td> |
| </tr> |
| |
| |
| |
| <?php |
| foreach($dropType as $value) { |
| $prefix=$typeToPrefix[$value]; |
| |
| foreach($buildBranches as $bValue) { |
| |
| if (array_key_exists ($bValue, $latestFile) && array_key_exists($prefix, $latestFile[$bValue])) { |
| $fileName = $latestFile[$bValue][$prefix]; |
| echo "<tr>"; |
| echo "<td width=\"25%\">$value</td>"; |
| |
| |
| $fileNameParts = explode("-", $fileName); |
| |
| if (sizeof($fileNameParts) > 1) { |
| echo "<td width=\"25%\"><a href=\"drops/$bValue/$fileName/\">$fileNameParts[1]</a></td>"; |
| echo "<td width=\"15%\">$bValue</td>"; |
| echo "<td width=\"40%\">$timeStamps[$fileName]</td>"; |
| echo "</tr>"; |
| } |
| } |
| } |
| } |
| ?> |
| |
| </table> |