blob: 49ff9918e90e57daad8ca393ac397296036e6937 [file] [log] [blame]
david_williamsfd220c82008-01-07 07:59:37 +00001<?php
2
3function getSubDirectory($directoryName) {
4 if (file_exists($directoryName) && is_dir($directoryName)) {
5 //echo "Debug: anArtifactEntry (directory): " . $completeName . "<br />";
6 $aDirectory = dir($directoryName);
7 while (false !== ($anEntry = $aDirectory->read())) {
8 if ($anEntry != "." && $anEntry!="..") {
9 return $directoryName."/".$anEntry;
10 }
11 }
12 }
13}
14
15function computeMainData($buildBranches, $debugScript)
16
17{
18 global $buckets, $latestFile, $latestTimeStamp, $timeStamps;
19
20 foreach ($buildBranches as $buildBranch ) {
21
22 if (file_exists($buildBranch) && is_dir($buildBranch)) {
23 $aDirectory = dir($buildBranch);
24 $latestTimeStamp[$buildBranch] = array();
25 $latestFile[$buildBranch] = array();
26
27 while (false !== ($anArtifactEntry = $aDirectory->read())) {
28 //echo "anArtifactEntryDirectory: " . $anArtifactEntry . "<br />";
29
30 // Short cut because we know aDirectory only contains other directories.
31 if ($anArtifactEntry != "." && $anArtifactEntry!="..") {
32 $completeName = $buildBranch."/".$anArtifactEntry;
33 if (file_exists($completeName) && is_dir($completeName)) {
34 //echo "Debug: anArtifactEntry (directory): " . $completeName . "<br />";
35 $anArtifactEntryDirectory = dir($completeName);
36
37 while (false !== ($anEntry = $anArtifactEntryDirectory->read())) {
38
39 // Short cut because we know aDirectory only contains other directories.
40 if ($anEntry != "." && $anEntry!="..") {
41
42 //echo "Debug anEntry: $anEntry<br />" ;
43 $aDropDirectoryName = getSubDirectory($completeName);
44 //echo "Debug aDropDirectoryDirectoryName: $aDropDirectoryName <br />" ;
45
46
47 if (is_dir($aDropDirectoryName) && is_Readable($aDropDirectoryName)) {
48 $aDropDirectory = dir($aDropDirectoryName);
49 //echo "Debug aDropDirectory: $aDropDirectory->path <br />" ;
50
51 $fileCount = 0;
52 while ($aDropEntry = $aDropDirectory->read()) {
53 //echo "Debug aDropEntry: $aDropEntry<br />" ;
54 if ( (stristr($aDropEntry, ".tar.gz")) || (stristr($aDropEntry, ".zip")) ) {
55 // Count the dropfile entry in the directory (so we won't display links, if not all there
56 $fileCount = $fileCount + 1;
57 }
58 }
59
60 $aDropDirectory->close();
61
62 }
63 // Read the count file
64 $countFile = $aDropDirectoryName."/files.count";
65 $indexFile = $aDropDirectoryName."/index.html";
66
67
68 if (!file_exists($indexFile)) {
69 $indexFile = $aDropDirectoryName."/index.php";
70 }
71
72
73 if (file_exists($countFile) && file_exists($indexFile)) {
74 $anArray = file($countFile);
75 // echo "Debug: Number according to files.count: ", $anArray[0], "<br />";
76 // echo "Debug: actual counted files: ", $fileCount, "<br />";
77
78 // If a match - process the directoryVV -- we simply look that there's more
79 // zip's than we expect, since it frequently breaks where the count is slighly
80 // off, such as when we add, after the fact, an all-in-one zip.
81 if ($anArray[0] <= $fileCount) {
82 //echo "Debug: yes, counted equaled expected count<br />";
83 $anEntryLine = explode("/", $aDropDirectoryName);
84 $artifactTimeStamp = $anEntryLine[1]."/";
85 $entryParts = explode("-", $anEntryLine[2]);
86 if (count($entryParts) == 3) {
david_williams6ee19422008-01-07 19:24:41 +000087 include '../commonPages/processDropDirectory.php';
david_williamsfd220c82008-01-07 07:59:37 +000088 }
89 }
90 }
91
92 }
93 }
94 $anArtifactEntryDirectory->close();
95 }
96
97 }
98 }
99 $aDirectory->close();
100 }
101 }
102}
103?>