Skip to content

Commit

Permalink
MDL-58220 skydrive: Upgrade from old settings
Browse files Browse the repository at this point in the history
Upgrade the oauth2 settings to an oauth2 issuer.
  • Loading branch information
Damyon Wiese committed Apr 3, 2017
1 parent 0b9bb5b commit 6f8a03f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions repository/skydrive/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,26 @@ function xmldb_repository_skydrive_upgrade($oldversion) {
// Skydrive savepoint reached.
upgrade_plugin_savepoint(true, 2017031400, 'repository', 'skydrive');
}
if ($oldversion < 2017032800) {
$clientid = get_config('clientid', 'skydrive');
$secret = get_config('secret', 'skydrive');

// Update from repo config to use an OAuth service.
if (!empty($clientid) && !empty($secret)) {
$issuer = \core\oauth2\api::create_standard_issuer('microsoft');

$issuer->set('clientid', $clientid);
$issuer->set('secret', $secret);

$issuer->update();

set_config('issuerid', $issuer->get('id'), 'skydrive');
}
upgrade_plugin_savepoint(true, 2017032800, 'repository', 'skydrive');
}
if ($oldversion < 2017032900) {
set_config('supportedfiles', 'both', 'skydrive');
upgrade_plugin_savepoint(true, 2017032900, 'repository', 'skydrive');
}
return true;
}
2 changes: 1 addition & 1 deletion repository/skydrive/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2017031400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017032900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component = 'repository_skydrive'; // Full name of the plugin (used for diagnostics).

0 comments on commit 6f8a03f

Please sign in to comment.