added some config jargon
[glcas.git] / bin / updateyumrepo.php
index a4878fb..3cd0130 100644 (file)
@@ -36,10 +36,11 @@ error_log("called with $url and $file");
 
 $actionurl = "$url/repodata/repomd.xml";
 $repomdxml = file_get_contents($actionurl);
-file_put_contents("$file/repodata/repomd.xml", $repomdxml);
+if(file_exists("$file/repodata/repomd.xml.new")) unlink("$file/repodata/repomd.xml.new");
+file_put_contents("$file/repodata/repomd.xml.new", $repomdxml);
 
 
-$xml = simplexml_load_file("$file/repodata/repomd.xml");
+$xml = simplexml_load_file("$file/repodata/repomd.xml.new");
 
 
 foreach($xml as $key => $var) {
@@ -58,5 +59,10 @@ foreach($xml as $key => $var) {
 }
 
 unlink("$file/repodata/repoupdate.lock");
+if(file_exists("$file/repodata/repomd.xml")) {
+       unlink("$file/repodata/repomd.xml");
+}
+rename("$file/repodata/repomd.xml.new", "$file/repodata/repomd.xml")
 
+// TODO: check for outdated repodata files and delete
 ?>
\ No newline at end of file