From: Sara Arjona Date: Mon, 26 Oct 2020 21:44:05 +0000 (+0100) Subject: Merge branch 'MDL-65959-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE X-Git-Tag: v3.10.0-beta~11 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=0dd7bb8374eab7ac85af7d5448dbc83161fce709 Merge branch 'MDL-65959-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE --- 0dd7bb8374eab7ac85af7d5448dbc83161fce709 diff --cc lib/db/upgrade.php index 249d23b8911,24975943424..5237245212b --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@@ -2864,17 -2863,45 +2864,56 @@@ function xmldb_main_upgrade($oldversion } if ($oldversion < 2020102300.01) { - global $DB, $CFG; + // Define field downloadcontent to be added to course. + $table = new xmldb_table('course'); + $field = new xmldb_field('downloadcontent', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'visibleold'); + + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + // Main savepoint reached. + upgrade_main_savepoint(true, 2020102300.01); + } + ++ if ($oldversion < 2020102300.02) { + $table = new xmldb_table('badge_backpack'); + $uniquekey = new xmldb_key('backpackcredentials', XMLDB_KEY_UNIQUE, ['userid', 'externalbackpackid']); + + // All external backpack providers/hosts are now exclusively stored in badge_external_backpack. + // All credentials are stored in badge_backpack and are unique per user, backpack. + if (!$dbman->find_key_name($table, $uniquekey)) { + $dbman->add_key($table, $uniquekey); + } + + // If there is a current backpack set then copy it across to the new structure. + if ($CFG->badges_defaultissuercontact) { + // Get the currently used site backpacks. + $records = $DB->get_records_select('badge_external_backpack', "password IS NOT NULL AND password != ''"); + $backpack = [ + 'userid' => '0', + 'email' => $CFG->badges_defaultissuercontact, + 'backpackuid' => -1 + ]; + + // Create records corresponding to the site backpacks. + foreach ($records as $record) { + $backpack['password'] = $record->password; + $backpack['externalbackpackid'] = $record->id; + $DB->insert_record('badge_backpack', (object) $backpack); + } + } + + // Drop the password field as this is moved to badge_backpack. + $table = new xmldb_table('badge_external_backpack'); + $field = new xmldb_field('password', XMLDB_TYPE_CHAR, '50'); + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + + // Main savepoint reached. - upgrade_main_savepoint(true, 2020102300.01); ++ upgrade_main_savepoint(true, 2020102300.02); + } + return true; } diff --cc version.php index 3b91464230e,3b91464230e..2f08fc2f0af --- a/version.php +++ b/version.php @@@ -29,7 -29,7 +29,7 @@@ defined('MOODLE_INTERNAL') || die(); --$version = 2020102300.01; // YYYYMMDD = weekly release date of this DEV branch. ++$version = 2020102300.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '3.10dev+ (Build: 20201023)';// Human-friendly version name