]> git.mjollnir.org Git - moodle.git/commitdiff
Don't let downloaded environment files cause problems forever by overriding the
authormoodler <moodler>
Tue, 9 Jan 2007 05:52:11 +0000 (05:52 +0000)
committermoodler <moodler>
Tue, 9 Jan 2007 05:52:11 +0000 (05:52 +0000)
more up-to-date internal files

lib/environmentlib.php

index 29ddf31f7bd3438645d789898009a3ab142f5e39..179ed66173298481a6d1801a056da86342a7390a 100644 (file)
@@ -278,10 +278,11 @@ function load_environment_xml() {
 
 /// First of all, take a look inside $CFG->dataroot/environment/environment.xml
     $file = $CFG->dataroot.'/environment/environment.xml';
-    if (!is_file($file) || !is_readable($file) || !$contents = file_get_contents($file)) {
+    $internalfile = $CFG->dirroot.'/'.$CFG->admin.'/environment.xml';
+    if (!is_file($file) || !is_readable($file) || filemtime($file) < filemtime($internalfile) || 
+        !$contents = file_get_contents($file)) {
     /// Fallback to fixed $CFG->admin/environment.xml
-        $file = $CFG->dirroot.'/'.$CFG->admin.'/environment.xml';
-        if (!is_file($file) || !is_readable($file) || !$contents = file_get_contents($file)) {
+        if (!is_file($internalfile) || !is_readable($internalfile) || !$contents = file_get_contents($internalfile)) {
             return false;
         }
     }