From: moodler Date: Wed, 28 Jan 2004 04:26:58 +0000 (+0000) Subject: Allow modules to define the version of Moodle they require, and X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6deb891b4c5679cfb13857830eefcafac4cd75c9;p=moodle.git Allow modules to define the version of Moodle they require, and abort their installation if this requirement isn't met. --- diff --git a/admin/index.php b/admin/index.php index f1cad6f1df..6f562327aa 100644 --- a/admin/index.php +++ b/admin/index.php @@ -238,17 +238,32 @@ continue; } - if (!isset($module)) { continue; } + if (!empty($module->requires)) { + if ($module->requires > $CFG->version) { + $info->modulename = $mod; + $info->moduleversion = $module->version; + $info->currentmoodle = $CFG->version; + $info->requiremoodle = $module->requires; + notify(get_string('modulerequirementsnotmet', 'error', $info)); + unset($info); + continue; + } + } + $module->name = $mod; // The name MUST match the directory if ($currmodule = get_record("modules", "name", $module->name)) { if ($currmodule->version == $module->version) { // do nothing } else if ($currmodule->version < $module->version) { + if (empty($updated_modules)) { + $strmodulesetup = get_string("modulesetup"); + print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, "", "", false, " ", " "); + } print_heading("$module->name module needs upgrading"); $upgrade_function = $module->name."_upgrade"; if (function_exists($upgrade_function)) {