$this->config->saveConfig();
}
- if(file_exists("$repostore/$rkey/repodata/repoupdate.lock")) {
- echo " - <font color=\"red\">Repo locked for update</font><br>";
+ if(!isset($repo["repotype"])) {
+ echo "<font color=\"red\">Repo type not set for repo</font><br>";
+ } else if($repo["repotype"] == "YUM") {
+ if(file_exists("$repostore/$rkey/repodata/repoupdate.lock")) {
+ echo " - <font color=\"red\">Repo locked for update</font><br>";
+
+ }
- }
-
- // we still do this next bit, even if its locked because it may be a stray file
- echo " - Expire time is ".$repo["expiretime"]." days, checking repo<br>";
- error_log("checking $repostore/$rkey/repodata/repomd.xml");
- $tdiff = time() - filemtime("$repostore/$rkey/repodata/repomd.xml");
- $maxtdiff = $repo["expiretime"] * 24 * 3600;
- if($tdiff > $maxtdiff) {
- echo " - <font color=\"green\">updating repo</font><br>";
- $this->updateRepo($rkey);
- } else {
- echo " - not updating repo<br>";
+ // we still do this next bit, even if its locked because it may be a stray file
+ echo " - Expire time is ".$repo["expiretime"]." days, checking repo<br>";
+ error_log("checking $repostore/$rkey/repodata/repomd.xml");
+ $tdiff = time() - filemtime("$repostore/$rkey/repodata/repomd.xml");
+ $maxtdiff = $repo["expiretime"] * 24 * 3600;
+ if($tdiff > $maxtdiff) {
+ echo " - <font color=\"green\">updating repo</font><br>";
+ $this->updateRepo($rkey);
+ } else {
+ echo " - not updating repo<br>";
+ }
+ } else if($repo["repotype"] == "APT") {
+ echo "<font color=\"red\">I have no idea how to spawn an update of an APT repo - apt is crap</font><br>";
}
}
}
$content .= "<html><head><title>Index of $localfile</title></head><body><h1>Index of $localfile</h1>";
$content .= "<table>";
$dh = opendir($dir);
+ $dirn = 0;
+ $filen = 0;
while(($file = readdir($dh))!==false) {
- if($file != "." && $file != "..") $content .= "<tr><td><a href=\"$uri/$file\">$file</a></td></tr>";
+ if($file != "." && $file != "..") {
+ if(is_dir("$dir/$file")) {
+ $dirlist[$dirn++] = "$file";
+ } else {
+ $filelist[$filen++] = "$file";
+ }
+ }
+ }
+ if(isset($dirlist)) {
+ sort($dirlist);
+ foreach($dirlist as $dirs) {
+ $icon = "/icons/folder.png";
+ $content .= "<tr><td><img src=\"$icon\"></td><td><a href=\"$uri/$dirs\">$dirs</a></td><td></td></tr>";
+ }
+ }
+ if(isset($filelist)) {
+ sort($filelist);
+ foreach($filelist as $files) {
+ $fsize = filesize("$dir/$files");
+ $icon = "/icons/text.png";
+ $content .= "<tr><td><img src=\"$icon\"></td><td><a href=\"$uri/$files\">$files</a></td><td>$fsize</td></tr>";
+ }
}
$content .= "</table></body></html>";
} else return false;
}
+
+ function getRepoDetailsApt($url)
+ {
+ $action1 = $url."/dists";
+
+ // we just want to make sure it exists really
+ error_log("in repo details apt for $url");
+ if(!glcas_isRemoteDir($action1)) {
+ //echo "I cant find any valid APT dists's at $url<br>";
+ return false;
+ }
+
+ // ok, now scan for ubuntu dists as
+ $kos = getKnownOSList();
+
+ $repos = 0;
+ $existing_repo["isrepo"] = true;
+ foreach($kos["apt"] as $key => $val) {
+ //echo "<br>$key, $val<br>";
+ //echo "now check, $action1/$key";
+ if(glcas_isRemoteDir($action1."/$key")) {
+ $existing_repos["knownrepo"][$repos] = $key;
+ $repos++;
+ //echo "Found Distro $val<br>";
+ }
+ }
+ $existing_repos["nrepos"] = $repos;
+
+ // TODO: these need to be "calculated"
+ $existing_repos["distros"] = "Ubuntu, Debian";
+ $existing_repos["versions"] = "8.04LTS, 9.10, 10.04LTS, 10.10, 11.04, 11.10";
+ $existing_repos["arch"] = "x86_64, i386";
+
+
+ return $existing_repos;
+
+ }
function getRepoDetailsYum($url, $ismirrorlist=false)
{