X-Git-Url: http://git.pjr.cc/?p=glcas.git;a=blobdiff_plain;f=plugins%2Frepo.php;h=c2017562f7baa1e39daa348af916638a4b34e51c;hp=55eaed30b732fd421cf2a187350604d12f6456f8;hb=e935e20710eff1bcae9da93ead67ba0c4a4a849e;hpb=ce16a1b219c25bd3cb3b803b4fec36dd557ead1b diff --git a/plugins/repo.php b/plugins/repo.php index 55eaed3..c201756 100644 --- a/plugins/repo.php +++ b/plugins/repo.php @@ -35,21 +35,27 @@ class GLCASRepo { $this->config->saveConfig(); } - if(file_exists("$repostore/$rkey/repodata/repoupdate.lock")) { - echo " - Repo locked for update
"; + if(!isset($repo["repotype"])) { + echo "Repo type not set for repo
"; + } else if($repo["repotype"] == "YUM") { + if(file_exists("$repostore/$rkey/repodata/repoupdate.lock")) { + echo " - Repo locked for update
"; + + } - } - - // 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
"; - 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 " - updating repo
"; - $this->updateRepo($rkey); - } else { - echo " - not updating repo
"; + // 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
"; + 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 " - updating repo
"; + $this->updateRepo($rkey); + } else { + echo " - not updating repo
"; + } + } else if($repo["repotype"] == "APT") { + echo "I have no idea how to spawn an update of an APT repo - apt is crap
"; } } } @@ -745,18 +751,32 @@ class GLCASRepo { $content .= "Index of $localfile

Index of $localfile

"; $content .= ""; $dh = opendir($dir); + $dirn = 0; + $filen = 0; while(($file = readdir($dh))!==false) { if($file != "." && $file != "..") { if(is_dir("$dir/$file")) { - $fsize = ""; - $icon = "/icons/folder.png"; + $dirlist[$dirn++] = "$file"; } else { - $fsize = filesize("$dir/$file"); - $icon = "/icons/text.png"; + $filelist[$filen++] = "$file"; } - $content .= ""; } } + if(isset($dirlist)) { + sort($dirlist); + foreach($dirlist as $dirs) { + $icon = "/icons/folder.png"; + $content .= ""; + } + } + if(isset($filelist)) { + sort($filelist); + foreach($filelist as $files) { + $fsize = filesize("$dir/$files"); + $icon = "/icons/text.png"; + $content .= ""; + } + } $content .= "
$file$fsize
$dirs
$files$fsize
"; GLCASpageBuilder(null, null, $content);