mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-28313 fix incorrect enrol database settings upgrade
This commit is contained in:
parent
ecb8829273
commit
43c5c08cf7
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -62,9 +61,9 @@ function xmldb_enrol_database_install() {
|
||||
set_config('localuserfield', $CFG->enrol_localuserfield, 'enrol_database');
|
||||
unset_config('enrol_localuserfield');
|
||||
}
|
||||
if (isset($CFG->enrol_localrolefield)) {
|
||||
set_config('localrolefield', $CFG->enrol_localrolefield, 'enrol_database');
|
||||
unset_config('enrol_localrolefield');
|
||||
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');
|
||||
@ -74,9 +73,9 @@ function xmldb_enrol_database_install() {
|
||||
set_config('remoteuserfield', $CFG->enrol_remoteuserfield, 'enrol_database');
|
||||
unset_config('enrol_remoteuserfield');
|
||||
}
|
||||
if (isset($CFG->enrol_remoterolefield)) {
|
||||
set_config('remoterolefield', $CFG->enrol_remoterolefield, 'enrol_database');
|
||||
unset_config('enrol_remoterolefield');
|
||||
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');
|
||||
@ -96,6 +95,7 @@ function xmldb_enrol_database_install() {
|
||||
unset_config('enrol_db_ignorehiddencourse');
|
||||
}
|
||||
|
||||
unset_config('enrol_db_disableunenrol');
|
||||
|
||||
|
||||
|
||||
|
43
enrol/database/db/upgrade.php
Normal file
43
enrol/database/db/upgrade.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Database enrolment plugin upgrade.
|
||||
*
|
||||
* @package enrol
|
||||
* @subpackage database
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
@ -26,5 +26,5 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2010073100;
|
||||
$plugin->version = 2010073101;
|
||||
//TODO: should we add cron sync?
|
Loading…
x
Reference in New Issue
Block a user