X-Git-Url: http://git.pjr.cc/?p=glcas.git;a=blobdiff_plain;f=plugins%2Frepo.php;fp=plugins%2Frepo.php;h=1546e61a10f19e2c84d6746e1269bcf5233cc4e9;hp=0f325049229df92c7b70e530a4d715b70c2d1f52;hb=37b5d51a06265cba25c1c92418223837c6d3ad2b;hpb=fd77672af03a95b0d016c0c1cd76c0441a8857d1 diff --git a/plugins/repo.php b/plugins/repo.php index 0f32504..1546e61 100644 --- a/plugins/repo.php +++ b/plugins/repo.php @@ -7,21 +7,22 @@ class GLCASRepo { function __construct($config) { $this->config = $config; - if($this->config->getConfigVar("storagelocation") == false) { + if($this->config->getConfig("storagelocation") == false) { global $WEB_ROOT_FS; $storloc = "$WEB_ROOT_FS/../var/glcas/cache/"; if(!file_exists($storloc)) mkdir($storloc); - $this->config->setConfigVar("storagelocation", realpath($storloc)); - $this->config->saveConfig(); + $this->config->setConfig("storagelocation", realpath($storloc)); error_log("set storage location, $storloc"); } } + + // with the move to the sqlite db, this is going to get painful function cron() { //echo "
";
-		$uconf = unserialize($this->config->getConfigVar("repodata"));
-		$repostore = $this->config->getConfigVar("storagelocation");
+		$uconf = unserialize($this->config->getConfig("repodata"));
+		$repostore = $this->config->getConfig("storagelocation");
 		//print_r($uconf);
 		//echo "
"; @@ -38,14 +39,14 @@ class GLCASRepo { echo " - Expire time not set, setting to 2 days by default
"; $uconf[$rkey]["expiretime"] = 2; $repo["expiretime"] = 2; - $this->config->setConfigVar("repodata", serialize($uconf)); + $this->config->setConfig("repodata", serialize($uconf)); $this->config->saveConfig(); } if(!isset($repo["repotype"])) { echo "Repo type not set for repo, setting to yum
"; $uconf[$rkey]["repotype"] = "YUM"; - $this->config->setConfigVar("repodata", serialize($uconf)); + $this->config->setConfig("repodata", serialize($uconf)); $this->config->saveConfig(); } else if($repo["repotype"] == "YUM") { if($repofrozen) { @@ -153,8 +154,8 @@ class GLCASRepo { $xurl = split("[/,]", $url); // first get the config - $uconf = unserialize($this->config->getConfigVar("repodata")); - $repostore = $this->config->getConfigVar("storagelocation"); + $uconf = unserialize($this->config->getConfig("repodata")); + $repostore = $this->config->getConfig("storagelocation"); // preset matched to -1 $matched = -1; @@ -256,8 +257,8 @@ class GLCASRepo { function serveUpFile($actualfile, $repoid) { - $uconf = unserialize($this->config->getConfigVar("repodata")); - $repostore = $this->config->getConfigVar("storagelocation"); + $uconf = unserialize($this->config->getConfig("repodata")); + $repostore = $this->config->getConfig("storagelocation"); // figure out the range header garbage that centos/redhat send if(isset($_SERVER["HTTP_RANGE"])) { @@ -344,8 +345,8 @@ class GLCASRepo { clearstatcache(); // get the configurations we need - $uconf = unserialize($this->config->getConfigVar("repodata")); - $repostore = $this->config->getConfigVar("storagelocation"); + $uconf = unserialize($this->config->getConfig("repodata")); + $repostore = $this->config->getConfig("storagelocation"); @@ -745,8 +746,8 @@ class GLCASRepo { function freezeRepo($rkey) { - $uconf = $this->config->getConfigVar("repodata"); - $repostore = $this->config->getConfigVar("storagelocation"); + $uconf = $this->config->getConfig("repodata"); + $repostore = $this->config->getConfig("storagelocation"); if($uconf !== false) { $conf = unserialize($uconf); @@ -765,7 +766,7 @@ class GLCASRepo { } $nconf = serialize($conf); error_log("freeze repo as $rkey"); - $this->config->setConfigVar("repodata", $nconf); + $this->config->setConfig("repodata", $nconf); $this->config->saveConfig(); } } @@ -774,8 +775,8 @@ class GLCASRepo { function deleteRepo($rkey) { - $uconf = $this->config->getConfigVar("repodata"); - $repostore = $this->config->getConfigVar("storagelocation"); + $uconf = $this->config->getConfig("repodata"); + $repostore = $this->config->getConfig("storagelocation"); if($uconf !== false) { $conf = unserialize($uconf); @@ -785,7 +786,7 @@ class GLCASRepo { $nconf = serialize($conf); system("rm -rf $repostore/$key"); error_log("remove repo as $rkey"); - $this->config->setConfigVar("repodata", $nconf); + $this->config->setConfig("repodata", $nconf); $this->config->saveConfig(); } } @@ -794,7 +795,7 @@ class GLCASRepo { function addRepo($desc, $os, $version, $arch, $other, $shorturl, $prefix, $repurl, $repotype, $init, $expiretime, $blocklist=null) { - $uconf = $this->config->getConfigVar("repodata"); + $uconf = $this->config->getConfig("repodata"); $cs["desc"] = $desc; $cs["os"] = $os; @@ -825,11 +826,11 @@ class GLCASRepo { $nconf = serialize($conf); error_log("add repo as $ckey"); - $this->config->setConfigVar("repodata", $nconf); + $this->config->setConfig("repodata", $nconf); $this->config->saveConfig(); // now create the base structure in the repo - $repostore = $this->config->getConfigVar("storagelocation"); + $repostore = $this->config->getConfig("storagelocation"); // now call update repo @@ -853,7 +854,7 @@ class GLCASRepo { function updateRepoApt($repokey) { - $repostore = $this->config->getConfigVar("storagelocation"); + $repostore = $this->config->getConfig("storagelocation"); $repod = $this->getRepo($repokey); @@ -882,7 +883,7 @@ class GLCASRepo { function updateRepoYum($repokey) { - $repostore = $this->config->getConfigVar("storagelocation"); + $repostore = $this->config->getConfig("storagelocation"); $repod = $this->getRepo($repokey); @@ -911,7 +912,7 @@ class GLCASRepo { function getRepo($id) { - $uconf = $this->config->getConfigVar("repodata"); + $uconf = $this->config->getConfig("repodata"); if($uconf !== false) { $lconf = unserialize($uconf); return $lconf[$id]; @@ -921,7 +922,7 @@ class GLCASRepo { function getRepos() { - $uconf = $this->config->getConfigVar("repodata"); + $uconf = $this->config->getConfig("repodata"); if($uconf !== false) { return unserialize($uconf); } else return false;