diff --git a/repository/googledocs/db/upgrade.php b/repository/googledocs/db/upgrade.php index da8d731a947..2a5698ef3c1 100644 --- a/repository/googledocs/db/upgrade.php +++ b/repository/googledocs/db/upgrade.php @@ -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; } diff --git a/repository/googledocs/version.php b/repository/googledocs/version.php index 04eaa0e8fab..ce8f197427a 100644 --- a/repository/googledocs/version.php +++ b/repository/googledocs/version.php @@ -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).