mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDl-58220 auth_oauth2: Skip upgrade for new plugin
This commit is contained in:
parent
8d90d29460
commit
5aa0f0ae48
@ -38,74 +38,5 @@ function xmldb_auth_oauth2_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2017030700) {
|
||||
|
||||
// Define table auth_oauth2_linked_login to be created.
|
||||
$table = new xmldb_table('auth_oauth2_linked_login');
|
||||
|
||||
// Adding fields to table auth_oauth2_linked_login.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('issuerid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('username', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('email', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table auth_oauth2_linked_login.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('usermodified_key', XMLDB_KEY_FOREIGN, array('usermodified'), 'user', array('id'));
|
||||
$table->add_key('userid_key', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
$table->add_key('issuerid_key', XMLDB_KEY_FOREIGN, array('issuerid'), 'oauth2_issuer', array('id'));
|
||||
$table->add_key('uniq_key', XMLDB_KEY_UNIQUE, array('userid', 'issuerid', 'username'));
|
||||
|
||||
// Adding indexes to table auth_oauth2_linked_login.
|
||||
$table->add_index('search_index', XMLDB_INDEX_NOTUNIQUE, array('issuerid', 'username'));
|
||||
|
||||
// Conditionally launch create table for auth_oauth2_linked_login.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Oauth2 savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2017030700, 'auth', 'oauth2');
|
||||
}
|
||||
|
||||
if ($oldversion < 2017031000) {
|
||||
|
||||
// Changing type of field email on table auth_oauth2_linked_login to text.
|
||||
$table = new xmldb_table('auth_oauth2_linked_login');
|
||||
$field = new xmldb_field('email', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'username');
|
||||
|
||||
// Launch change of type for field email.
|
||||
$dbman->change_field_type($table, $field);
|
||||
|
||||
// Oauth2 savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2017031000, 'auth', 'oauth2');
|
||||
}
|
||||
|
||||
if ($oldversion < 2017032300) {
|
||||
|
||||
// Define field confirmtoken to be added to auth_oauth2_linked_login.
|
||||
$table = new xmldb_table('auth_oauth2_linked_login');
|
||||
$field = new xmldb_field('confirmtoken', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null, 'email');
|
||||
|
||||
// Conditionally launch add field confirmtoken.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('confirmtokenexpires', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'confirmtoken');
|
||||
|
||||
// Conditionally launch add field confirmtokenexpires.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Oauth2 savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2017032300, 'auth', 'oauth2');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user