function listLogs($myDir) { $aDirectory = dir($myDir); $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; if (is_file($path)) { $entries[$index] = $anEntry; $index++; } } $aDirectory->close(); if (!empty($entries)) { sort($entries); } if ($index < 0) { echo "<br>There are no logs for this build."; return; } for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $line = "<td><a href=\"{$myDir}/{$anEntry}\">{$anEntry}</a>" . fileSizeForDisplay("{$myDir}/{$anEntry}") . "</td>"; echo "<li>{$line}</li>"; } }
function listLogs($myDir) { $entries = array(); $aDirectory = dir($myDir); if ($aDirectory === NULL || $aDirectory === FALSE) { return; } $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; # if ((is_file($path)) && (preg_match("/.txt/i", $path))) { $c = checkFile($path); if ($c == 1) { $entries[$index] = $anEntry; $index++; } } $aDirectory->close(); if (count($entries) > 0) { sort($entries); } if ($index < 0) { echo "<p>There are no test logs for this build.</p>\n"; return; } echo "<ul>\n"; for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $updateLine = 0; $updateLine = checkPlatform($anEntry); if ($updateLine == 0 && preg_match("/\\//", $myDir)) { $linktext = $myDir . "_" . $anEntry; # remove the directory name from the link to the log $dir = substr(strrchr($linktext, "/"), 1); $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $dir . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } else { $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $anEntry . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } echo "<li>{$line}</li>\n"; } echo "</ul>\n"; }