mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-30610 remove outdated enrol upgrade code
This commit is contained in:
parent
612d65d037
commit
3751e28f1c
@ -23,81 +23,5 @@
|
||||
function xmldb_enrol_authorize_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
//===== 1.9.0 upgrade line ======//
|
||||
|
||||
if ($oldversion < 2008092700) {
|
||||
/// enrol_authorize.transid
|
||||
/// Define index transid (not unique) to be dropped form enrol_authorize
|
||||
$table = new xmldb_table('enrol_authorize');
|
||||
$index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
/// Changing precision of field transid on table enrol_authorize to (20)
|
||||
$table = new xmldb_table('enrol_authorize');
|
||||
$field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'userid');
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
/// Launch add index transid again
|
||||
$table = new xmldb_table('enrol_authorize');
|
||||
$index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
$dbman->add_index($table, $index);
|
||||
|
||||
/// enrol_authorize_refunds.transid
|
||||
/// Define index transid (not unique) to be dropped form enrol_authorize_refunds
|
||||
$table = new xmldb_table('enrol_authorize_refunds');
|
||||
$index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
/// Changing precision of field transid on table enrol_authorize_refunds to (20)
|
||||
$table = new xmldb_table('enrol_authorize_refunds');
|
||||
$field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, '0', 'amount');
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
/// Launch add index transid again
|
||||
$table = new xmldb_table('enrol_authorize_refunds');
|
||||
$index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
|
||||
$dbman->add_index($table, $index);
|
||||
|
||||
/// authorize savepoint reached
|
||||
upgrade_plugin_savepoint(true, 2008092700, 'enrol', 'authorize');
|
||||
}
|
||||
|
||||
/// Dropping all enums/check contraints from core. MDL-18577
|
||||
if ($oldversion < 2009042700) {
|
||||
|
||||
/// Changing list of values (enum) of field paymentmethod on table enrol_authorize to none
|
||||
$table = new xmldb_table('enrol_authorize');
|
||||
$field = new xmldb_field('paymentmethod', XMLDB_TYPE_CHAR, '6', null, XMLDB_NOTNULL, null, 'cc', 'id');
|
||||
|
||||
/// Launch change of list of values for field paymentmethod
|
||||
$dbman->drop_enum_from_field($table, $field);
|
||||
|
||||
/// authorize savepoint reached
|
||||
upgrade_plugin_savepoint(true, 2009042700, 'enrol', 'authorize');
|
||||
}
|
||||
|
||||
// Add instanceid field to enrol_authorize table
|
||||
if ($oldversion < 2010081203) {
|
||||
$table = new xmldb_table('enrol_authorize');
|
||||
$field = new xmldb_field('instanceid');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'userid');
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_plugin_savepoint(true, 2010081203, 'enrol', 'authorize');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -30,44 +30,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_category_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
if (!$DB->record_exists_select('role_assignments', "contextid IN (SELECT id FROM {context} WHERE contextlevel = ?)", array(CONTEXT_COURSECAT))) {
|
||||
// fresh install or nobody used category enrol
|
||||
return;
|
||||
}
|
||||
|
||||
// existing sites need a way to keep category role enrols, but we do not want to encourage that on new sites
|
||||
|
||||
// extremely ugly hack, the sync depends on the capabilities so we unfortunately force update of caps here
|
||||
// note: this is not officially supported and should not be copied elsewhere! :-(
|
||||
update_capabilities('enrol_category');
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$archetypes = array('student', 'teacher', 'editingteacher');
|
||||
$enableplugin = false;
|
||||
foreach ($archetypes as $archetype) {
|
||||
$roles = get_archetype_roles($archetype);
|
||||
foreach ($roles as $role) {
|
||||
if (!$DB->record_exists_select('role_assignments', "roleid = ? AND contextid IN (SELECT id FROM {context} WHERE contextlevel = ?)", array($role->id, CONTEXT_COURSECAT))) {
|
||||
continue;
|
||||
}
|
||||
assign_capability('enrol/category:synchronised', CAP_ALLOW, $role->id, $syscontext->id, true);
|
||||
$levels = get_role_contextlevels($role->id);
|
||||
$levels[] = CONTEXT_COURSECAT;
|
||||
set_role_contextlevels($role->id, $levels);
|
||||
$enableplugin = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$enableplugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
// enable this plugin
|
||||
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
|
||||
$enabledplugins[] = 'category';
|
||||
$enabledplugins = array_unique($enabledplugins);
|
||||
set_config('enrol_plugins_enabled', implode(',', $enabledplugins));
|
||||
|
||||
// brute force course resync, this may take a while
|
||||
require_once("$CFG->dirroot/enrol/category/locallib.php");
|
||||
enrol_category_sync_full();
|
||||
}
|
||||
|
@ -28,83 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_database_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// migrate old config settings first
|
||||
if (isset($CFG->enrol_dbtype)) {
|
||||
set_config('dbtype', $CFG->enrol_dbtype, 'enrol_database');
|
||||
unset_config('enrol_dbtype');
|
||||
}
|
||||
if (isset($CFG->enrol_dbhost)) {
|
||||
set_config('dbhost', $CFG->enrol_dbhost, 'enrol_database');
|
||||
unset_config('enrol_dbhost');
|
||||
}
|
||||
if (isset($CFG->enrol_dbuser)) {
|
||||
set_config('dbuser', $CFG->enrol_dbuser, 'enrol_database');
|
||||
unset_config('enrol_dbuser');
|
||||
}
|
||||
if (isset($CFG->enrol_dbpass)) {
|
||||
set_config('dbpass', $CFG->enrol_dbpass, 'enrol_database');
|
||||
unset_config('enrol_dbpass');
|
||||
}
|
||||
if (isset($CFG->enrol_dbname)) {
|
||||
set_config('dbname', $CFG->enrol_dbname, 'enrol_database');
|
||||
unset_config('enrol_dbname');
|
||||
}
|
||||
if (isset($CFG->enrol_dbtable)) {
|
||||
set_config('remoteenroltable', $CFG->enrol_dbtable, 'enrol_database');
|
||||
unset_config('enrol_dbtable');
|
||||
}
|
||||
if (isset($CFG->enrol_localcoursefield)) {
|
||||
set_config('localcoursefield', $CFG->enrol_localcoursefield, 'enrol_database');
|
||||
unset_config('enrol_localcoursefield');
|
||||
}
|
||||
if (isset($CFG->enrol_localuserfield)) {
|
||||
set_config('localuserfield', $CFG->enrol_localuserfield, 'enrol_database');
|
||||
unset_config('enrol_localuserfield');
|
||||
}
|
||||
if (isset($CFG->enrol_db_localrolefield)) {
|
||||
set_config('localrolefield', $CFG->enrol_db_localrolefield, 'enrol_database');
|
||||
unset_config('enrol_db_localrolefield');
|
||||
}
|
||||
if (isset($CFG->enrol_remotecoursefield)) {
|
||||
set_config('remotecoursefield', $CFG->enrol_remotecoursefield, 'enrol_database');
|
||||
unset_config('enrol_remotecoursefield');
|
||||
}
|
||||
if (isset($CFG->enrol_remoteuserfield)) {
|
||||
set_config('remoteuserfield', $CFG->enrol_remoteuserfield, 'enrol_database');
|
||||
unset_config('enrol_remoteuserfield');
|
||||
}
|
||||
if (isset($CFG->enrol_db_remoterolefield)) {
|
||||
set_config('remoterolefield', $CFG->enrol_db_remoterolefield, 'enrol_database');
|
||||
unset_config('enrol_db_remoterolefield');
|
||||
}
|
||||
if (isset($CFG->enrol_db_defaultcourseroleid)) {
|
||||
set_config('defaultrole', $CFG->enrol_db_defaultcourseroleid, 'enrol_database');
|
||||
unset_config('enrol_db_defaultcourseroleid');
|
||||
}
|
||||
unset_config('enrol_db_autocreate'); // replaced by new coruse temple sync
|
||||
if (isset($CFG->enrol_db_category)) {
|
||||
set_config('defaultcategory', $CFG->enrol_db_category, 'enrol_database');
|
||||
unset_config('enrol_db_category');
|
||||
}
|
||||
if (isset($CFG->enrol_db_template)) {
|
||||
set_config('templatecourse', $CFG->enrol_db_template, 'enrol_database');
|
||||
unset_config('enrol_db_template');
|
||||
}
|
||||
if (isset($CFG->enrol_db_ignorehiddencourse)) {
|
||||
set_config('ignorehiddencourses', $CFG->enrol_db_ignorehiddencourse, 'enrol_database');
|
||||
unset_config('enrol_db_ignorehiddencourse');
|
||||
}
|
||||
|
||||
unset_config('enrol_db_disableunenrol');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// just make sure there are no leftovers after disabled plugin
|
||||
if (!$DB->record_exists('enrol', array('enrol'=>'database'))) {
|
||||
role_unassign_all(array('component'=>'enrol_database'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -27,20 +27,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_database_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// fix leftovers after incorrect 2.x upgrade in install.php
|
||||
if ($oldversion < 2010073101) {
|
||||
unset_config('enrol_db_localrolefield');
|
||||
unset_config('enrol_db_remoterolefield');
|
||||
unset_config('enrol_db_disableunenrol');
|
||||
|
||||
upgrade_plugin_savepoint(true, 2010073101, 'enrol', 'database');
|
||||
}
|
||||
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -29,41 +29,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$result = TRUE;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2010091400) {
|
||||
|
||||
// Define table enrol_flatfile to be created
|
||||
$table = new xmldb_table('enrol_flatfile');
|
||||
|
||||
// Adding fields to table enrol_flatfile
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('action', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('roleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timestart', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timeend', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table enrol_flatfile
|
||||
$table->add_key('id', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('courseid-id', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
|
||||
$table->add_key('userid-id', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
$table->add_key('roleid-id', XMLDB_KEY_FOREIGN, array('roleid'), 'role', array('id'));
|
||||
|
||||
// Conditionally launch create table for enrol_flatfile
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// flatfile savepoint reached
|
||||
upgrade_plugin_savepoint(true, 2010091400, 'enrol', 'flatfile');
|
||||
}
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
@ -28,51 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_imsenterprise_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// NOTE: this file is executed during upgrade from 1.9.x!
|
||||
|
||||
|
||||
// this plugin does not use the new file api - lets undo the migration
|
||||
$fs = get_file_storage();
|
||||
|
||||
if ($DB->record_exists('course', array('id'=>1))) { //course 1 is hardcoded here intentionally!
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, 1)) {
|
||||
if ($file = $fs->get_file($context->id, 'course', 'legacy', 0, '/', 'imsenterprise-enrol.xml')) {
|
||||
if (!file_exists("$CFG->dataroot/1/imsenterprise-enrol.xml")) {
|
||||
check_dir_exists($CFG->dataroot.'/');
|
||||
$file->copy_content_to("$CFG->dataroot/1/imsenterprise-enrol.xml");
|
||||
}
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($CFG->enrol_imsfilelocation)) {
|
||||
if (strpos($CFG->enrol_imsfilelocation, "$CFG->dataroot/") === 0) {
|
||||
$location = str_replace("$CFG->dataroot/", '', $CFG->enrol_imsfilelocation);
|
||||
$location = str_replace('\\', '/', $location);
|
||||
$parts = explode('/', $location);
|
||||
$courseid = array_shift($parts);
|
||||
if (is_number($courseid) and $DB->record_exists('course', array('id'=>$courseid))) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $courseid)) {
|
||||
$file = array_pop($parts);
|
||||
if ($parts) {
|
||||
$dir = '/'.implode('/', $parts).'/';
|
||||
} else {
|
||||
$dir = '/';
|
||||
}
|
||||
if ($file = $fs->get_file($context->id, 'course', 'legacy', 0, $dir, $file)) {
|
||||
if (!file_exists($CFG->enrol_imsfilelocation)) {
|
||||
check_dir_exists($CFG->dataroot.'/'.$courseid.$dir);
|
||||
$file->copy_content_to($CFG->enrol_imsfilelocation);
|
||||
}
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: migrate old config settings
|
||||
|
||||
}
|
||||
|
@ -28,64 +28,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
|
||||
//NOTE: this file is not executed during upgrade from 1.9.x!
|
||||
|
||||
|
||||
if ($oldversion < 2011013000) {
|
||||
// this plugin does not use the new file api - lets undo the migration
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
||||
if ($DB->record_exists('course', array('id'=>1))) { //course 1 is hardcoded here intentionally!
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, 1)) {
|
||||
if ($file = $fs->get_file($context->id, 'course', 'legacy', 0, '/', 'imsenterprise-enrol.xml')) {
|
||||
if (!file_exists("$CFG->dataroot/1/imsenterprise-enrol.xml")) {
|
||||
check_dir_exists($CFG->dataroot.'/');
|
||||
$file->copy_content_to("$CFG->dataroot/1/imsenterprise-enrol.xml");
|
||||
}
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($CFG->enrol_imsfilelocation)) {
|
||||
if (strpos($CFG->enrol_imsfilelocation, "$CFG->dataroot/") === 0) {
|
||||
$location = str_replace("$CFG->dataroot/", '', $CFG->enrol_imsfilelocation);
|
||||
$location = str_replace('\\', '/', $location);
|
||||
$parts = explode('/', $location);
|
||||
$courseid = array_shift($parts);
|
||||
if (is_number($courseid) and $DB->record_exists('course', array('id'=>$courseid))) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $courseid)) {
|
||||
$file = array_pop($parts);
|
||||
if ($parts) {
|
||||
$dir = '/'.implode('/', $parts).'/';
|
||||
} else {
|
||||
$dir = '/';
|
||||
}
|
||||
if ($file = $fs->get_file($context->id, 'course', 'legacy', 0, $dir, $file)) {
|
||||
if (!file_exists($CFG->enrol_imsfilelocation)) {
|
||||
check_dir_exists($CFG->dataroot.'/'.$courseid.$dir);
|
||||
$file->copy_content_to($CFG->enrol_imsfilelocation);
|
||||
}
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2011013000, 'enrol', 'imsenterprise');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,76 +30,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_ldap_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Check for the presence of old 'legacy' config settings. If they
|
||||
// exist, correct them.
|
||||
if (isset($CFG->enrol_ldap_student_contexts)) {
|
||||
if ($student_role = $DB->get_record('role', array('shortname' => 'student'))) {
|
||||
set_config('enrol_ldap_contexts_role'.$student_role->id, $CFG->enrol_ldap_student_contexts);
|
||||
}
|
||||
unset_config('enrol_ldap_student_contexts');
|
||||
}
|
||||
|
||||
if (isset($CFG->enrol_ldap_student_memberattribute)) {
|
||||
if (isset($student_role) or $student_role = $DB->get_record('role', array('shortname' => 'student'))) {
|
||||
set_config('enrol_ldap_memberattribute_role'.$student_role->id, $CFG->enrol_ldap_student_memberattribute);
|
||||
}
|
||||
unset_config('enrol_ldap_student_memberattribute');
|
||||
}
|
||||
|
||||
if (isset($CFG->enrol_ldap_teacher_contexts)) {
|
||||
if ($teacher_role = $DB->get_record('role', array('shortname' => 'editingteacher'))) {
|
||||
set_config('enrol_ldap_contexts_role'.$teacher_role->id, $CFG->enrol_ldap_student_contexts);
|
||||
}
|
||||
unset_config('enrol_ldap_teacher_contexts');
|
||||
}
|
||||
|
||||
if (isset($CFG->enrol_ldap_teacher_memberattribute)) {
|
||||
if (isset($teacher_role) or $teacher_role = $DB->get_record('role', array('shortname' => 'teacher'))) {
|
||||
set_config('enrol_ldap_memberattribute_role'.$teacher_role->id, $CFG->enrol_ldap_teacher_memberattribute);
|
||||
}
|
||||
|
||||
unset_config('enrol_ldap_teacher_memberattribute');
|
||||
}
|
||||
|
||||
// Now migrate the real plugin settings. 'enrol_ldap_version' is the only
|
||||
// setting that cannot be migrated like the rest, as it clashes with the
|
||||
// plugin version number once we strip the 'enrol_ldap_' prefix.
|
||||
if (isset($CFG->enrol_ldap_version)) {
|
||||
set_config('ldap_version', $CFG->enrol_ldap_version, 'enrol_ldap');
|
||||
unset_config('enrol_ldap_version');
|
||||
}
|
||||
|
||||
$settings = array ('host_url', 'bind_dn', 'bind_pw', 'objectclass', 'course_idnumber',
|
||||
'course_shortname', 'course_fullname', 'course_summary',
|
||||
'course_shortname_updatelocal', 'course_fullname_updatelocal', 'course_summary_updatelocal',
|
||||
'course_shortname_editlock', 'course_fullname_editlock', 'course_summary_editlock',
|
||||
'autocreate', 'category', 'template');
|
||||
|
||||
// Add roles settings to the array of settings to migrate.
|
||||
$roles = $DB->get_records('role');
|
||||
foreach($roles as $role) {
|
||||
array_push($settings, 'contexts_role'.$role->id);
|
||||
array_push($settings, 'memberattribute_role'.$role->id);
|
||||
}
|
||||
|
||||
// Migrate all the settings from $CFG->enrol_ldap_XXXXX to the
|
||||
// plugin configuration in mdl_config_plugin, stripping the 'enrol_ldap_' prefix.
|
||||
foreach ($settings as $setting) {
|
||||
if (isset($CFG->{'enrol_ldap_'.$setting})) {
|
||||
set_config($setting, $CFG->{'enrol_ldap_'.$setting}, 'enrol_ldap');
|
||||
unset_config('enrol_ldap_'.$setting);
|
||||
}
|
||||
}
|
||||
|
||||
// $CFG->enrol_ldap_search_sub is special, as we need to rename it to
|
||||
// course_search_sub' (there is also a new search_sub for users)
|
||||
if (isset($CFG->enrol_ldap_search_sub)) {
|
||||
set_config('course_search_sub', $CFG->enrol_ldap_search_sub, 'enrol_ldap');
|
||||
unset_config('enrol_ldap_search_sub');
|
||||
}
|
||||
|
||||
// Remove a setting that's never been used at all
|
||||
if (isset($CFG->enrol_ldap_user_memberfield)) {
|
||||
unset_config('enrol_ldap_user_memberfield');
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_manual_install() {
|
||||
global $CFG;
|
||||
|
||||
// migrate settings during 2.0 upgrade
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,17 +29,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_meta_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
if (isset($CFG->nonmetacoursesyncroleids)) {
|
||||
set_config('nosyncroleids', $CFG->nonmetacoursesyncroleids, 'enrol_meta');
|
||||
unset_config('nonmetacoursesyncroleids');
|
||||
}
|
||||
|
||||
if (!$DB->record_exists('enrol', array('enrol'=>'meta'))) {
|
||||
// no need to syn roles and enrolments
|
||||
return;
|
||||
}
|
||||
|
||||
// brute force course resync, this may take a while
|
||||
require_once("$CFG->dirroot/enrol/meta/locallib.php");
|
||||
enrol_meta_sync();
|
||||
}
|
||||
|
@ -29,18 +29,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_mnet_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
// when core upgraded all legacy enrol mnet plugins, it created instances of the plugin
|
||||
// here we set customint1 to 0 which means 'open for all hosts' (legacy behaviour)
|
||||
if ($oldversion < 2010071701) {
|
||||
$DB->set_field('enrol', 'customint1', 0, array('enrol' => 'mnet', 'customint1' => null));
|
||||
upgrade_plugin_savepoint(true, 2010071701, 'enrol', 'mnet');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -44,26 +44,5 @@
|
||||
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
//===== 1.9.0 upgrade line ======//
|
||||
|
||||
// Add instanceid field to enrol_paypal table
|
||||
if ($oldversion < 2010071500) {
|
||||
$table = new xmldb_table('enrol_paypal');
|
||||
$field = new xmldb_field('instanceid');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'userid');
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_plugin_savepoint(true, 2010071500, 'enrol', 'paypal');
|
||||
}
|
||||
|
||||
// Moodle v2.1.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
// Moodle v2.2.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -28,18 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_self_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
// migrate welcome message
|
||||
if (isset($CFG->sendcoursewelcomemessage)) {
|
||||
set_config('sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, 'enrol_self'); // new course default
|
||||
$DB->set_field('enrol', 'customint4', $CFG->sendcoursewelcomemessage, array('enrol'=>'self')); // each instance has different setting now
|
||||
unset_config('sendcoursewelcomemessage');
|
||||
}
|
||||
|
||||
// migrate long-time-no-see feature settings
|
||||
if (isset($CFG->longtimenosee)) {
|
||||
$nosee = $CFG->longtimenosee * 3600 * 24;
|
||||
set_config('longtimenosee', $nosee, 'enrol_self');
|
||||
$DB->set_field('enrol', 'customint2', $nosee, array('enrol'=>'self'));
|
||||
unset_config('longtimenosee');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user