3 // begin unit test header
4 $WEB_ROOT_FS = realpath(dirname(__FILE__));
5 $BASE_URL = dirname($_SERVER["PHP_SELF"]);
7 global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
9 if(file_exists("../libglcas")) {
10 $path = realpath($WEB_ROOT_FS."/../");
11 error_log("added glcas path as $path");
12 set_include_path(get_include_path().PATH_SEPARATOR.$path);
14 require_once("../libglcas/lib.php");
22 // TODO: do this better
23 if(file_exists($WEB_ROOT_FS."/../var")) {
26 if(file_exists($WEB_ROOT_FS."/../var/glcas/webconfig")) {
27 $configpath = realpath("$WEB_ROOT_FS/../var/glcas/webconfig");
29 // if not, attempt to create
30 if(!file_exists($WEB_ROOT_FS."/../var/glcas")) {
31 mkdir($WEB_ROOT_FS."/../var/glcas");
34 touch("$WEB_ROOT_FS/../var/glcas/webconfig");
35 $configpath = realpath("$WEB_ROOT_FS/../var/glcas/webconfig");
40 $glconfig = new GLCASConfig();
41 $glconfig->loadConfig($configpath);
44 // end unit test header
45 $repostore = $glconfig->getConfigVar("storagelocation");
47 // find a repomd.xml file
50 for($i=0; $i<100; $i++) {
51 //echo "Checking $repostore/$i\n";
52 if(file_exists($repostore."/$i/repodata/repomd.xml")) $ckey = $i;
56 echo "couldnt find a ckey";
60 $xml = simplexml_load_file($repostore."/$ckey/repodata/repomd.xml");
62 //echo "XML $ckey is:\n";
65 foreach($xml as $key => $var) {
66 //echo "for key $key has:\n";
69 $fileloc = $var->location["href"];
70 echo "file loc to load: $fileloc\n";