From 4943a856d096ecfb45955b7b5ef649d0567e89ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Arenaza?= Date: Wed, 24 Apr 2013 23:31:48 +0200 Subject: [PATCH] MDL-39323 Make sure start_tls config value is defined This has been introduced in 2.5, so when upgrading from previous versions make sure we set a default value. Otherwise, we get a notice about it being undefined when we try to use it (and we always try to use it!). --- auth/cas/db/upgrade.php | 43 ++++++++++++++++++++++++++++++++++++++++ auth/cas/version.php | 2 +- auth/ldap/db/upgrade.php | 43 ++++++++++++++++++++++++++++++++++++++++ auth/ldap/version.php | 2 +- 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 auth/cas/db/upgrade.php create mode 100644 auth/ldap/db/upgrade.php diff --git a/auth/cas/db/upgrade.php b/auth/cas/db/upgrade.php new file mode 100644 index 00000000000..75e5b589890 --- /dev/null +++ b/auth/cas/db/upgrade.php @@ -0,0 +1,43 @@ +. + +/** + * CAS authentication plugin upgrade code + * + * @package auth_cas + * @copyright 2013 Iñaki Arenaza + * @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_cas_upgrade($oldversion) { + + // Moodle v2.5.0 release upgrade line + // Put any upgrade step following this + + // MDL-39323 New setting in 2.5, make sure it's defined. + if ($oldversion < 2013052100) { + if (get_config('start_tls', 'auth/cas') === false) { + set_config('start_tls', 0, 'auth/cas'); + } + upgrade_plugin_savepoint(true, 2013052100, 'auth', 'cas'); + } + + return true; +} diff --git a/auth/cas/version.php b/auth/cas/version.php index 3be1c896c4e..b18fa1acdf8 100644 --- a/auth/cas/version.php +++ b/auth/cas/version.php @@ -26,6 +26,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2013050100; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2013052100; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2013050100; // Requires this Moodle version $plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics) diff --git a/auth/ldap/db/upgrade.php b/auth/ldap/db/upgrade.php new file mode 100644 index 00000000000..2d88860a7dd --- /dev/null +++ b/auth/ldap/db/upgrade.php @@ -0,0 +1,43 @@ +. + +/** + * LDAP authentication plugin upgrade code + * + * @package auth_ldap + * @copyright 2013 Iñaki Arenaza + * @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_ldap_upgrade($oldversion) { + + // Moodle v2.5.0 release upgrade line + // Put any upgrade step following this + + // MDL-39323 New setting in 2.5, make sure it's defined. + if ($oldversion < 2013052100) { + if (get_config('start_tls', 'auth/ldap') === false) { + set_config('start_tls', 0, 'auth/ldap'); + } + upgrade_plugin_savepoint(true, 2013051200, 'auth', 'ldap'); + } + + return true; +} diff --git a/auth/ldap/version.php b/auth/ldap/version.php index 6f44d6374e9..37f0ca836e5 100644 --- a/auth/ldap/version.php +++ b/auth/ldap/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2013050100; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2013052100; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2013050100; // Requires this Moodle version $plugin->component = 'auth_ldap'; // Full name of the plugin (used for diagnostics)