From: stronk7 Date: Tue, 5 Aug 2008 00:22:41 +0000 (+0000) Subject: Make custom checks BC, so any test about future releases doesn't fail X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=eae02f59b02eb3205f5b60df82c7f1d1a871f8e4;p=moodle.git Make custom checks BC, so any test about future releases doesn't fail with error it the file and/or function is missing (highly possible). MDL-15939 ; merged from 18_STABLE --- diff --git a/lib/environmentlib.php b/lib/environmentlib.php index e5ddcdacca..825beaf3ad 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -524,6 +524,9 @@ function environment_custom_checks($version) { $results = array(); +/// Get current Moodle version (release) for later compare + $current_version = normalize_version($CFG->release); + /// Get the enviroment version we need if (!$data = get_environment_for_version($version)) { /// Error. No version data found - but this will already have been reported. @@ -554,12 +557,30 @@ function environment_custom_checks($version) { $result->setInfo($function); $result = $function($result); } else { - $result->setStatus(false); - $result->setErrorCode(CUSTOM_CHECK_FUNCTION_MISSING); + /// Only show error for current version (where function MUST exist) + /// else, we are performing custom checks against future versiosn + /// and function MAY not exist, so it doesn't cause error, just skip + /// custom check by returning null. MDL-15939 + if (version_compare($current_version, $version, '>=')) { + $result->setStatus(false); + $result->setInfo($function); + $result->setErrorCode(CUSTOM_CHECK_FUNCTION_MISSING); + } else { + $result = null; + } } } else { - $result->setStatus(false); - $result->setErrorCode(CUSTOM_CHECK_FILE_MISSING); + /// Only show error for current version (where function MUST exist) + /// else, we are performing custom checks against future versiosn + /// and function MAY not exist, so it doesn't cause error, just skip + /// custom check by returning null. MDL-15939 + if (version_compare($current_version, $version, '>=')) { + $result->setStatus(false); + $result->setInfo($function); + $result->setErrorCode(CUSTOM_CHECK_FILE_MISSING); + } else { + $result = null; + } } } else { $result->setStatus(false);