From: moodler Date: Tue, 9 Jan 2007 05:52:11 +0000 (+0000) Subject: Don't let downloaded environment files cause problems forever by overriding the X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=38fca5d7c77b037d5739043262eb62767cf024c3;p=moodle.git Don't let downloaded environment files cause problems forever by overriding the more up-to-date internal files --- diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 29ddf31f7b..179ed66173 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -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; } }