[multienrol]Some database upgrade to preserve the default enrolment plugin

This commit is contained in:
martinlanghoff
2006-03-09 03:02:37 +00:00
parent 4d3f4df562
commit 54e9516e59
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -1403,6 +1403,12 @@ function main_upgrade($oldversion=0) {
if ($oldversion < 2006030900) {
table_column('course','','enrol','varchar','20','','');
set_config('enrol_plugins_enabled', $CFG->enrol);
require_once("$CFG->dirroot/enrol/enrol.class.php");
$defaultenrol = enrolment_factory::factory($CFG->enrol);
if (!method_exists($defaultenrol, 'print_entry')) { // switch enrollable to off for all courses in this case
modify_database('', 'UPDATE prefix_couse SET enrollable = 0');
}
}
return $result;