MDL-58128 googledocs: Upgrade repo config

Part of MDL-58220
This commit is contained in:
Damyon Wiese 2017-03-05 16:13:53 +08:00
parent d247a63dfa
commit 6c9cd495a2
2 changed files with 18 additions and 1 deletions

View File

@ -48,6 +48,23 @@ function xmldb_repository_googledocs_upgrade($oldversion) {
// Plugin savepoint reached.
upgrade_plugin_savepoint(true, 2017011100, 'repository', 'googledocs');
}
if ($oldversion < 2017030500) {
$clientid = get_config('clientid', 'googledocs');
$secret = get_config('secret', 'googledocs');
// Update from repo config to use an OAuth service.
if (!empty($clientid) && !empty($secret)) {
$issuer = \core\oauth2\api::create_standard_issuer('google');
$issuer->set('clientid', $clientid);
$issuer->set('secret', $secret);
$issuer->update();
set_config('issuerid', $issuer->get('id'), 'googledocs');
}
upgrade_plugin_savepoint(true, 2017030500, 'repository', 'googledocs');
}
return true;
}

View File

@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017011100; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017030500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component = 'repository_googledocs'; // Full name of the plugin (used for diagnostics).