From 38fca5d7c77b037d5739043262eb62767cf024c3 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 9 Jan 2007 05:52:11 +0000 Subject: [PATCH] Don't let downloaded environment files cause problems forever by overriding the more up-to-date internal files --- lib/environmentlib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; } } -- 2.39.5