From 94cf0a1e56d167ceb4881bd27339e30e3970612c Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Tue, 13 Jul 2010 11:14:29 +0000 Subject: [PATCH] MDL-23245 Fixed plugin type of auth_mnet in config_plugins table --- admin/mnet/access_control.php | 2 +- auth/mnet/auth.php | 8 +++--- auth/mnet/db/upgrade.php | 47 +++++++++++++++++++++++++++++++++++ auth/mnet/version.php | 2 +- enrol/mnet/enrol.php | 2 +- 5 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 auth/mnet/db/upgrade.php diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 4dfd146ba74..0d8d870d534 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -130,7 +130,7 @@ if (!is_enabled_auth('mnet')) { $warn .= '

' . get_string('authmnetdisabled','mnet').'

'; } -if (get_config('auth/mnet', 'auto_add_remote_users') != true) { +if (get_config('auth_mnet', 'auto_add_remote_users') != true) { $warn .= '

' . get_string('authmnetautoadddisabled','mnet').'

'; } if (!empty($warn)) { diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 2eb20c960e5..c7f543118fb 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -28,7 +28,7 @@ class auth_plugin_mnet extends auth_plugin_base { */ function auth_plugin_mnet() { $this->authtype = 'mnet'; - $this->config = get_config('auth/mnet'); + $this->config = get_config('auth_mnet'); $this->mnet = get_mnet_environment(); } @@ -154,7 +154,7 @@ class auth_plugin_mnet extends auth_plugin_base { // set RPC timeout to 30 seconds if not configured // TODO: Is this needed/useful/problematic? if (empty($this->config->rpc_negotiation_timeout)) { - set_config('rpc_negotiation_timeout', '30', 'auth/mnet'); + set_config('rpc_negotiation_timeout', '30', 'auth_mnet'); } // get the host info @@ -679,11 +679,11 @@ class auth_plugin_mnet extends auth_plugin_base { if (!isset ($config->auto_add_remote_users)) { $config->auto_add_remote_users = '0'; } See MDL-21327 for why this is commented out - set_config('auto_add_remote_users', $config->auto_add_remote_users, 'auth/mnet'); + set_config('auto_add_remote_users', $config->auto_add_remote_users, 'auth_mnet'); */ // save settings - set_config('rpc_negotiation_timeout', $config->rpc_negotiation_timeout, 'auth/mnet'); + set_config('rpc_negotiation_timeout', $config->rpc_negotiation_timeout, 'auth_mnet'); return true; } diff --git a/auth/mnet/db/upgrade.php b/auth/mnet/db/upgrade.php new file mode 100644 index 00000000000..6ac021a08ed --- /dev/null +++ b/auth/mnet/db/upgrade.php @@ -0,0 +1,47 @@ +. + +/** + * Keeps track of upgrades to the auth_mnet plugin + * + * @package auth + * @subpackage mnet + * @copyright 2010 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * @param int $oldversion the version we are upgrading from + * @return bool result + */ +function xmldb_auth_mnet_upgrade($oldversion) { + global $CFG, $DB, $OUTPUT; + + // fix the plugin type in config_plugins table + if ($oldversion < 2010071300) { + if ($configs = $DB->get_records('config_plugins', array('plugin' => 'auth/mnet'))) { + foreach ($configs as $config) { + unset_config($config->name, $config->plugin); + set_config($config->name, $config->value, 'auth_mnet'); + } + } + unset($configs); + upgrade_plugin_savepoint(true, 2010071300, 'auth', 'mnet'); + } + + return true; +} diff --git a/auth/mnet/version.php b/auth/mnet/version.php index 6ab273cb6a0..8b2a4f6abf6 100644 --- a/auth/mnet/version.php +++ b/auth/mnet/version.php @@ -1,3 +1,3 @@ version = 2010021800; +$plugin->version = 2010071300; diff --git a/enrol/mnet/enrol.php b/enrol/mnet/enrol.php index 67fdf3cfa4d..68167129b88 100644 --- a/enrol/mnet/enrol.php +++ b/enrol/mnet/enrol.php @@ -300,7 +300,7 @@ class enrolment_plugin_mnet { if ($userrecord == false) { $userrecord = mnet_strip_user((object)$user, mnet_fields_to_import($remoteclient)); - /* there used to be a setting in auth/mnet called auto_create_users + /* there used to be a setting in auth_mnet called auto_add_remote_users * which we should have been checking here (but weren't). * this setting has now been removed. See MDL-21327 */