2 $URL_HANDLERS["*"] = "GLCASRepo";
6 function __construct($config)
8 $this->config = $config;
9 if($this->config->getConfigVar("storagelocation") == false) {
11 $storloc = "$WEB_ROOT_FS/../var/glcas/cache/";
12 if(!file_exists($storloc)) mkdir($storloc);
13 $this->config->setConfigVar("storagelocation", realpath($storloc));
14 $this->config->saveConfig();
15 error_log("set storage location, $storloc");
21 error_log("repo:go called");
23 // figure out what we're doing
26 GLCASpageBuilder($this, "body");
29 $this->getRepoForUrl($url);
35 // this is how this will work
37 if(strncasecmp("list", $url, 4)==0) {
38 echo "i am the repo list";
41 echo "i am the repo, $url";
45 // TODO: rework this function
47 * What i need to do is have a downloader function
48 * that can cope with lots of different shit
49 * but thats a pipe dream
51 * what *THIS* function needs to do is
52 * 1) figure out the repo
53 * 2) figure out the file in the repo
54 * 2.1) if its a directory, go to print directory
55 * 3) if the file exists, give it to the user (if a range is specified give the user the range)
56 * 4) if the file does not exist
57 * - check if a tmp file exists
58 * - attempt to get an exclusive flock
59 * - if flock fails, donwload in progress
60 * - if flock succeeds, truncate file and re-start download
61 * - if a range request was made, send the range once available
62 * - if range not available, sleep for 5 and check again.
64 * I dont want to code this from scratch, but i probably need to
66 function getRepoForUrl($url)
68 $xurl = split("[/,]", $url);
70 // first get the config
71 $uconf = unserialize($this->config->getConfigVar("repodata"));
72 $repostore = $this->config->getConfigVar("storagelocation");
74 // preset matched to -1
77 // first we check for /repo/repoid as a url
79 if($xurl[0] == "repo") {
81 error_log("trying to get repo for repoid, $repid");
82 if(isset($uconf[$repid])) {
83 $matched = ((int)($repid));
84 error_log("set matched, $matched, $repid");
89 // now check for a prefix match
91 if($matched < 0) foreach($uconf as $key => $var) {
92 $pre = $var["prefix"];
95 //echo "Checking pre $pre against ".$xurl[0]."\n";
96 if(strcasecmp($pre, $xurl[0])==0) {
97 //echo "Matched pre\n";
104 // next, check for a short url match
105 if($matched < 0) foreach($uconf as $key => $var) {
106 // if we matched a pre, then we check against the second url component
108 $short = $var["shorturl"];
111 //echo "Checking short $short against ".$xurl[$startat]."\n";
112 if(strcasecmp($xurl[$startat], $short)==0) {
120 // TODO: this deterministic bit
121 // so far nothing has matched - what this next bit needs to do is try and "Determine" a repo from url
122 // for eg, if a user gets /fedora/x86_64/os we need to return something appropriate
124 echo "No such repo<br>";
125 header("HTTP/1.0 404 Not Found");
130 // something was matched, so now we reconstruct the file component of the url
132 if(count($xurl) > $startat) for($i=$startat; $i < count($xurl); $i++) {
133 $file .= "/".$xurl[$i];
136 // so, the ultimate url for the file we need is:
137 $actualfile = "$repostore/$matched/$file";
138 error_log("Atcualfile is $actualfile");
140 // if its a directory, lets do a print
141 if(is_dir($actualfile)) {
142 $this->printDir($actualfile, $file, $url);
146 // check if the file exists and serve it up
147 if(file_exists($actualfile)) {
148 $this->serveUpFile($actualfile, $matched);
151 // the file does not exist, we now need to go into "download" mode
152 $remoteurl = $uconf[$matched]["url"]."/$file";
153 $this->downloadAndServe($actualfile, $matched, $remoteurl);
158 function serveUpFile($actualfile, $repoid)
160 $uconf = unserialize($this->config->getConfigVar("repodata"));
161 $repostore = $this->config->getConfigVar("storagelocation");
163 // figure out the range header garbage that centos/redhat send
164 if(isset($_SERVER["HTTP_RANGE"])) {
165 // we're using ranges - screw you stupid installer
166 $pr_range = preg_split("/[:\-=, ]+/", $_SERVER["HTTP_RANGE"]);
169 $rangestart = $pr_range[1];
170 $rangelength = $pr_range[2] - $pr_range[1] +1;
171 $rangestr = $pr_range[1]."-".$pr_range[2];
172 error_log("going ranges at $rangestart, $rangelength,".$rangesa[1].",".$rangesb[0]);
174 // now spit some headers
175 header("HTTP/1.1 206 Partial Content");
176 header("Content-Length: ".$rangelength);
179 header("Content-Range: bytes $rangesstr/".filesize($actualfile));
181 // determine mime type
182 $type = mime_content_type($actualfile);
184 // set mime type header
185 header("Content-type: $type");
187 // open the local file (TODO: error check)
188 $localfile = fopen($actualfile, "r");
189 fseek($localfile, $rangestart, SEEK_SET);
191 // read in the data, god i hope its not big
192 $data = fread($localfile, $rangelength);
198 // and close the file
203 // we're not using range's - good on you installer thingy
204 header("Content-Length: ".filesize($actualfile));
206 // set the mime type header
207 $type = mime_content_type($actualfile);
208 header("Content-type: $type");
210 // open the local file
211 $localfile = fopen($actualfile, "r");
213 error_log("normal upload went barf");
217 // iterate over its length, send 8k at a time
218 while(!feof($localfile)) {
219 // read and send data
220 $data = fread($localfile, 8192);
223 // flush so the client sees the data
233 // TODO: this is the function im working on
234 // the alternative to this function is that if a file is in the process of being
235 // downloaded, we simply serve from upstream... not a good idea tho unless we create
236 // a local proxy right here
237 function downloadAndServe($filename, $repoid, $remoteurl)
239 // this is important so downloads dont die
241 ignore_user_abort(true);
243 // get the configurations we need
244 $uconf = unserialize($this->config->getConfigVar("repodata"));
245 $repostore = $this->config->getConfigVar("storagelocation");
247 // this is the tricky one for ranges.
249 // check if a download exists
250 $otherdownloader = false;
251 if(file_exists("$filename.tmp.data.deleteme")) {
252 // a download exists, does it still work
253 error_log("DOWNLOADER: file exists for current download, hope it works, attempting lock");
254 $localtmpfh = fopen("$filename.tmp.data.deleteme", "r");
255 $lockres = flock($localtmpfh, LOCK_EX|LOCK_NB);
257 error_log("flock did fail, all is right with the world a download is in progress");
258 $otherdownloader = true;
260 error_log("lock succeeded, dieing in the arse");
261 unlink("$filename.tmp.data.deleteme");
262 unlink("$filename.tmp.data.deleteme.size");
266 // open the remote file
269 if(!$otherdownloader) {
270 $remotefile = fopen($remoteurl, "r");
271 $localfile = fopen($filename.".tmp.data.deleteme", "w");
272 $lockres = flock($localfile, LOCK_EX);
274 erorr_log("something went plop");
277 // get the headers from the remote request and use them to hurt people
279 foreach($http_response_header as $key => $val) {
280 if(preg_match("/HTTP.*30[1-9].*/", $val)) {
281 error_log("got a 30x, must be a directory");
283 header("Location: ".$_SERVER["REQUEST_URI"]."/");
286 // get content length form upstream and print
287 if(preg_match("/^Content-Length:.*/", $val)) {
288 // WARNING, THIS IS NOT RIGHT
289 $clentemp = preg_split("/[: ]+/", $val);
290 $contentlen = $clentemp[1];
293 // get content type from upstream and print
294 if(preg_match("/^Content-Type:.*/", $val)) {
298 header("HTTP/1.0 404 Not Found");
299 error_log("asked fore file that dont exist");
304 error_log("put contentlen as $contentlen");
305 file_put_contents($filename.".tmp.data.deleteme.size", $contentlen);
307 $localfile = fopen($filename.".tmp.data.deleteme", "r");
309 error_log("something went plop");
316 // determine if we're ranged
321 if(isset($_SERVER["HTTP_RANGE"])) {
322 // we're using ranges - screw you stupid installer
324 $pr_range = preg_split("/[:\-=, ]+/", $_SERVER["HTTP_RANGE"]);
325 error_log("got range ".$_SERVER["HTTP_RANGE"]." and ".print_r($pr_range, true));
328 $rangestart = $pr_range[1];
329 $rangelength = $pr_range[2] - $pr_range[1] +1;
330 $rangestr = $pr_range[1]."-".$pr_range[2];
331 error_log("going ranges at $rangestart, $rangelength,");
335 // open the local files
337 // now, lets determine what state we're in
338 // we're either - getting and sending
339 // watching and sending
340 // or a range (Getting and sending)
341 // or a range (watching and sending)
342 // TODO: it may be advicable to start the download as a seperate cli process rather then something goin on here
343 // so it definitely cant be interrupted.
346 // first, getting and sending - this is easy.
347 if(!$ranged && !$otherdownloader) {
348 while(!feof($remotefile)) {
349 $data = fread($remotefile, 2048);
352 fwrite($localfile, $data);
354 rename($filename.".tmp.data.deleteme", $filename);
355 unlink($filename.".tmp.data.deleteme.size");
364 } else if ($otherdownloader && !$ranged) {
365 // this is where the fun starts - but this one isnt too bad.
366 error_log("OTHERDOWNLOAD: im another downloader, please work");
367 $fsize = file_get_contents($filename.".tmp.data.deleteme.size");
368 header("Content-Length: $fsize");
370 while(!feof($localfile)) {
371 error_log("OTHERDOWNLOAD: get");
372 $data = fread($localfile, 2048);
374 error_log("dollardata is pair shaped");
376 $sgotten += strlen($data);
377 if($sgotten > $fsize) {
378 error_log("went plop at sgotten, $sgotten, $fsize");
387 // need to think about this in pseudo code.
388 // 1. close the file and wait for it to get to $sgotten + 2048 or $fsize
389 if(file_exists($filename.".tmp.data.deleteme")) $cursize = filesize($filename.".tmp.data.deleteme");
390 else if(file_exists($filename)) {
391 error_log("DOTHERDOWNLOADER: namechange");
392 $cursize = filesize($filename);
393 } else return; // we had to bail
396 $upload_finished = false;
397 while(!$upload_finished) {
398 while($cursize < $fsize && $cursize < ($sgotten+2048)) {
400 error_log("OTHERDOWNLOAD: halt, $cursize, $sgotten, $fsize");
401 // sleep until the the filesize is greater then what we're up to, or until the file is finished
403 if(file_exists($filename.".tmp.data.deleteme")) {
404 error_log("OTHERDOWNLOADER: still same name");
405 $cursize = filesize($filename.".tmp.data.deleteme");
406 } else if(file_exists($filename)) {
407 error_log("DOTHERDOWNLOADER: namechange");
408 $cursize = filesize($filename);
410 else return; // we had to bail
413 error_log("OTHERDOWNLOAD: continue, $sgotten, $fsize");
414 // reopen local file - if it stopped existing, we need to deal with that
415 if(file_exists($filename.".tmp.data.deleteme")) $localfile = fopen($filename.".tmp.data.deleteme", "r");
416 else if(file_exists($filename)) $localfile = fopen($filename, "r");
417 else return; // we had to bail
419 // UG, we need to ff, how could i forget that
420 fseek($localfile, $sgotten);
423 error_log("OTHERDOWNLOAD: something went plop");
427 // now loop on the file until we have it at an eof
428 while(!feof($localfile)) {
429 $data = fread($localfile, 512);
431 error_log("OTHERDOWNLOAD: dollar data went plop");
433 $sgotten += strlen($data);
440 if($sgotten >= $fsize) {
441 if($sgotten > $fsize) error_log("OTHERDOWNLOADER: finished but $sgotten, $fsize doesnt make senze");
442 $upload_finished = true;
447 error_log("OTHERDOWNLOADER: done with");
454 // THIS WAS JUST AWESOME CAUSE IT WORKS
456 } else if ($ranged && !$otherdownloader) {
461 // the problem is here
462 error_log("Downloader: going ranged as primary");
464 header("HTTP/1.1 206 Partial Content");
465 header("Content-Length: ".$rangelength);
466 header("Content-Range: bytes $rangestr/".$contentlen);
467 header("Content-Type: $contenttype");
468 header("Connection: close");
470 // first, get up to $rangestart
471 while(!feof($remotefile) && ftell($remotefile) < $rangestart) {
472 if(($rangestart - ftell($remotefile)) < 2048) $rsize = $rangestart;
474 $data = fread($remotefile, $rsize);
476 error_log("dollar data went plop");
478 $sgotten += strlen($data);
480 fwrite($localfile, $data);
484 error_log("should now be at rangestart: ".ftell($remotefile));
486 // now start pumping out data until $rangelength
487 $sgatlen = $rangelength + $rangestart;
488 while(!feof($remotefile) && ftell($remotefile) < $sgatlen ) {
491 $rsize = $sgatlen - ftell($remotefile);
492 if($rsize > 2048) $rsize = 2048;
494 $data = fread($remotefile, $rsize);
496 error_log("dollar data went plop");
499 $sgotten += strlen($data);
501 fwrite($localfile, $data);
505 // hopefully this works, the redhat/centos installer really is a terrible
506 // piece of code.. The reasons for this is that redhat in their minds decided
507 // to use ranges, and even though you send the range to the client, the client
508 // just keeps listening. and you can ignore the range request, it ignores you.
510 error_log("should now be at rangeend: $sgatlen, $rangestart, ".ftell($remotefile));
513 // now continue on as per normal - totally gunna work...
514 while(!feof($remotefile)) {
515 //error_log("back download");
516 $data = fread($remotefile, 2048);
518 fwrite($localfile, $data);
522 rename($filename.".tmp.data.deleteme", $filename);
523 unlink($filename.".tmp.data.deleteme.size");
533 } else if ($ranged && $otherdownloader) {
534 // and here too, yay, someone else is doing the
535 // download, but we're the retards getting a range
539 // the problem is here
540 error_log("Downloader: going ranged as primary");
542 header("HTTP/1.1 206 Partial Content");
543 header("Content-Length: ".$rangelength);
544 header("Content-Range: bytes $rangestr/".$contentlen);
545 header("Content-Type: $contenttype");
548 error_log("OTHERDOWNLOAD: im another downloader, please work for ranged");
556 // this is a nightmare
557 function getRepoForUrlOld($url)
559 // the way we breakdown a url is to explode it
560 $xurl = split("[/,]", $url);
562 // we first check if [0] is a prefix
563 // if now, we check for it being a shorturl (lets just do that for now)
564 $uconf = unserialize($this->config->getConfigVar("repodata"));
565 $repostore = $this->config->getConfigVar("storagelocation");
569 // first we check for /repo/repoid as a url
571 if($xurl[0] == "repo") {
573 error_log("trying to get repo for repoid, $repid");
574 if(isset($uconf[$repid])) {
575 $matched = ((int)($repid));
576 error_log("set matched, $matched, $repid");
583 if($matched < 0) foreach($uconf as $key => $var) {
584 $pre = $var["prefix"];
587 //echo "Checking pre $pre against ".$xurl[0]."\n";
588 if(strcasecmp($pre, $xurl[0])==0) {
589 //echo "Matched pre\n";
597 if($matched < 0) foreach($uconf as $key => $var) {
598 // if we matched a pre, then we check against the second url component
600 $short = $var["shorturl"];
603 //echo "Checking short $short against ".$xurl[$startat]."\n";
604 if(strcasecmp($xurl[$startat], $short)==0) {
613 echo "No such repo<br>";
618 // now we find an actual file
620 if(count($xurl) > $startat) for($i=$startat; $i < count($xurl); $i++) {
621 $file .= "/".$xurl[$i];
624 // now we want to find repostore/$matched/$file;
625 $actualfile = "$repostore/$matched/$file";
626 error_log("Atcualfile is $actualfile");
627 //echo "Start file for $actualfile\n";
629 // first check any directories in $file are in existence
630 $splfile = explode("/", $file);
631 if(count($splfile) > 1) {
632 $tomake = "$repostore/$matched/";
633 for($i = 0; $i < count($splfile)-1; $i++) {
634 $tomake .= "/".$splfile[$i];
635 //error_log("making directory $tomake");
636 if(!is_dir($tomake)) mkdir($tomake);
640 $reqhead = print_r($_REQUEST, true);
641 $sevhead = print_r($_SERVER, true);
643 error_log("req $reqhead");
644 error_log("sev $sevhead");
649 if(isset($_SERVER["HTTP_RANGE"])) {
651 $rangesa = explode("=", $_SERVER["HTTP_RANGE"]);
652 $rangesb = explode(",", $rangesa[1]);
653 $rangesstr = $rangesb[0];
654 $ranges = explode("-", $rangesb[0]);
655 $rangestart = $ranges[0];
656 $rangelength = $ranges[1] - $ranges[0] +1;
657 error_log("going ranges at $rangestart, $rangelength,".$rangesa[1].",".$rangesb[0]);
660 // i have to support http_range cause REDHAT/CENTOS IS annoying as all hell. christ, why do this?
661 if(is_file($actualfile)) {
662 // file is stored locally, away we go
663 if($rangelength != -1) {
664 header("HTTP/1.1 206 Partial Content");
665 header("Content-Length: ".$rangelength);
666 header("Content-Range: bytes $rangesstr/".filesize($actualfile));
667 //header("Content-Length: ".filesize($actualfile));
669 header("Content-Length: ".filesize($actualfile));
671 $type = mime_content_type($actualfile);
672 header("Content-type: $type");
673 $localfile = fopen($actualfile, "r");
674 if($rangestart!=-1) fseek($localfile, $rangestart, SEEK_SET);
675 while(!feof($localfile)) {
676 // cant make this high cause centos is crap
677 if($rangelength!=-1) {
678 $data = fread($localfile, $rangelength);
679 error_log("data size was ".strlen($data));
681 $data = fread($localfile, 2048);
687 if($rangelength!=-1) {
693 } else if(is_dir($actualfile)) {
694 //echo "in dir for $actualfile\n";
695 // here we print the contents of the directory
696 $this->printDir($actualfile, $file, $url);
699 //echo "in getcheck\n";
700 $remotefile = $uconf[$matched]["url"]."/$file";
702 // TODO: i should get remote contents with fopen/fread/fwrite as
703 // it should be more memory conservative and we can push to the end client
705 ignore_user_abort(true);
706 $rf = fopen($remotefile, "r");
707 error_log("attempting to get remote file $remotefile");
710 // hopefully this works. if we get a 30x message, it means we tried to get a directory
711 // i cant think of another way of dealing with it - but this is UGLY
712 // also get content length and content type
714 foreach($http_response_header as $key => $val) {
715 if(preg_match("/HTTP.*30[1-9].*/", $val)) {
716 error_log("got a 30x, must be a directory");
718 header("Location: ".$_SERVER["REQUEST_URI"]."/");
721 // get content length form upstream and print
722 if(preg_match("/^Content-Length:.*/", $val)) {
726 // get content type from upstream and print
727 if(preg_match("/^Content-Type:.*/", $val)) {
731 //error_log("repsonse: $http_response_header");
734 header("HTTP/1.0 404 Not Found");
736 $localfile = fopen($actualfile.".tmp.data.deleteme", "w");
737 $localsizefile = fopen($actualfile.".tmp.data.deleteme.size", "w");
738 fwrite($localsizefile, "$clen");
739 fclose($localsizefile);
741 $data = fread($rf, 8192);
743 fwrite($localfile, $data);
748 rename($actualfile.".tmp.data.deleteme", $actualfile);
749 //error_log("got actualfile, tried to save as $actualfile, did it work?");
753 //echo "got ".$file." for $url which is $actualfile\n";
755 //echo "</html></pre>";
758 function printDir($dir, $localfile, $baseurl)
760 $localfile = preg_replace("/\/\/+/", "/", $localfile);
761 $uri = $_SERVER["REQUEST_URI"];
764 $content .= "<html><head><title>Index of $localfile</title></head><body><h1>Index of $localfile</h1>";
765 $content .= "<table>";
767 while(($file = readdir($dh))!==false) {
768 if($file != "." && $file != "..") $content .= "<tr><td><a href=\"$uri/$file\">$file</a></td></tr>";
770 $content .= "</table></body></html>";
772 GLCASpageBuilder(null, null, $content);
777 function getRepoDetailsYum($url, $ismirrorlist=false)
779 $actionurl = $url."/repodata/repomd.xml";
781 error_log("Getting for action of $actionurl");
783 $ld = file_get_contents($actionurl);
785 // so here we try and get what this repository provides (os, version, arch), for yum this
786 // should come straight off the url... i.e. centos/6.0/os/x86_64/ (centos, 6.0, base os, 64bit arch)
788 if(!$ld) return false;
790 // ok, now we tokenize the url and try and guess at the content
791 $spurl = explode("/", $url);
793 // first, find the OS
794 $kos = getKnownOSList();
795 $glt["OS"] = "unknown";
796 $glt["verison"] = "unknown";
797 $glt["arch"] = "unknown";
798 $glt["other"] = "unknown";
799 foreach($spurl as $comp) {
802 foreach($kos["os"]["short"] as $kosname => $koslong) {
803 //error_log("Comparing $kosname and $koslong with $comp");
804 if(strcasecmp($kosname, $comp) == 0) {
805 //error_log("got $kosname, $koslong for $comp in $url");
806 //echo "<pre>inone\n"; print_r($koslong); echo "</pre>";
807 $glt["OS"] = $koslong;
811 // find a version, we assume its going to be something [numbers] and a . (optional)
812 if(preg_match("/^[0-9.]+$/", $comp)>0) {
813 //error_log("version match of $comp");
814 $glt["version"] = $comp;
817 // now architecture, this can be either i?86 or x86_64 - can also be arm or otherwise, but lets just go with this for now
818 foreach($kos["arch"] as $archinter => $archname ) {
819 //error_log("Comparing $archinter, $archname with $comp");
820 if(strcasecmp($archname, $comp) == 0) {
821 //error_log("arch match of $archname with $comp");
822 $glt["arch"] = $archname;
826 // other is a bt harder, we really have to guess at this one
827 if(strcasecmp("os", $comp) == 0) $glt["other"] = "OS";
828 if(strcasecmp("update", $comp) == 0) $glt["other"] = "Updates";
829 if(strcasecmp("updates", $comp) == 0) $glt["other"] = "Updates";
830 if(strcasecmp("everything", $comp) == 0) $glt["other"] = "OS";
837 function deleteRepo($rkey)
839 $uconf = $this->config->getConfigVar("repodata");
840 $repostore = $this->config->getConfigVar("storagelocation");
842 if($uconf !== false) {
843 $conf = unserialize($uconf);
844 foreach($conf as $key => $vla) {
846 unset($conf["$rkey"]);
847 $nconf = serialize($conf);
848 system("rm -rf $repostore/$key");
849 error_log("remove repo as $rkey");
850 $this->config->setConfigVar("repodata", $nconf);
851 $this->config->saveConfig();
857 function addRepo($desc, $os, $version, $arch, $other, $shorturl, $prefix, $repurl, $repotype, $init)
859 $uconf = $this->config->getConfigVar("repodata");
863 $cs["version"] = $version;
865 $cs["other"] = $other;
866 $cs["shorturl"] = $shorturl;
867 $cs["prefix"] = $prefix;
868 $cs["url"] = $repurl;
869 $cs["repotype"] = $repotype;
873 if($uconf !== false) {
874 $conf = unserialize($uconf);
875 foreach($conf as $key => $val) {
883 $nconf = serialize($conf);
885 error_log("add repo as $ckey");
886 $this->config->setConfigVar("repodata", $nconf);
887 $this->config->saveConfig();
889 // now create the base structure in the repo
890 $repostore = $this->config->getConfigVar("storagelocation");
893 // now call update repo
894 if($init) $this->updateRepoYum($ckey);
897 function updateRepo($repokey)
899 // we only do yum yet
900 $this->updateRepoYum($repokey);
903 function updateRepoYum($repokey)
905 $repostore = $this->config->getConfigVar("storagelocation");
907 $repod = $this->getRepo($repokey);
909 $repourl = $repod["url"];
911 if(!file_exists("$repostore/$repokey")) {
912 mkdir("$repostore/$repokey");
915 if(!file_exists("$repostore/$repokey/repodata")) {
916 mkdir("$repostore/$repokey/repodata");
919 //ignore_user_abort(true);
920 $actionurl = "$repourl/repodata/repomd.xml";
921 $repomdxml = file_get_contents($actionurl);
922 file_put_contents("$repostore/$repokey/repodata/repomd.xml", $repomdxml);
924 $xml = simplexml_load_file("$repostore/$repokey/repodata/repomd.xml");
927 foreach($xml as $key => $var) {
928 //echo "for key $key has:\n";
931 $fileloc = $var->location["href"];
932 if(!file_exists("$repostore/$repokey/$fileloc")) {
933 error_log("getting $fileloc for $repokey on $repourl");
934 $dlfile = file_get_contents("$repourl/$fileloc");
935 file_put_contents("$repostore/$repokey/$fileloc", $dlfile);
937 error_log("Not getting $fileloc because we already have it");
943 function getRepo($id)
945 $uconf = $this->config->getConfigVar("repodata");
946 if($uconf !== false) {
947 $lconf = unserialize($uconf);
955 $uconf = $this->config->getConfigVar("repodata");
956 if($uconf !== false) {
957 return unserialize($uconf);