Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 defined('MOODLE_INTERNAL') || die(); 18 19 /** 20 * @param int $oldversion the version we are upgrading from 21 * @return bool result 22 */ 23 function xmldb_repository_dropbox_upgrade($oldversion) { 24 global $CFG, $DB; 25 26 // Automatically generated Moodle v3.6.0 release upgrade line. 27 // Put any upgrade step following this. 28 29 // Automatically generated Moodle v3.7.0 release upgrade line. 30 // Put any upgrade step following this. 31 32 // Automatically generated Moodle v3.8.0 release upgrade line. 33 // Put any upgrade step following this. 34 35 // Automatically generated Moodle v3.9.0 release upgrade line. 36 // Put any upgrade step following this. 37 38 if ($oldversion < 2021052501) { 39 $key = get_config('dropbox', 'dropbox_key'); 40 $secret = get_config('dropbox', 'dropbox_secret'); 41 42 if ($key && $secret) { 43 $params = [ 44 'name' => 'Dropbox', 45 'clientid' => $key, 46 'clientsecret' => $secret, 47 'loginparamsoffline' => 'token_access_type=offline', 48 'image' => '', 49 'showonloginpage' => 0, // Internal services only. 50 ]; 51 $record = $DB->get_record('oauth2_issuer', ['name' => 'Dropbox'], 'id'); 52 if (!$record) { 53 $params = array_merge($params, [ 54 'timecreated' => time(), 55 'timemodified' => time(), 56 'usermodified' => time(), 57 'baseurl' => 0, 58 'sortorder' => '', 59 'loginparams' => '', 60 'requireconfirmation' => 1, 61 'alloweddomains' => '', 62 'loginscopes' => 'openid profile email', 63 'loginscopesoffline' => 'openid profile email', 64 ]); 65 $id = $DB->insert_record('oauth2_issuer', $params); 66 } else { 67 $id = $record->id; 68 $params['id'] = $id; 69 $DB->update_record('oauth2_issuer', $params); 70 } 71 72 set_config('dropbox_issuerid', $id, 'dropbox'); 73 unset_config('dropbox_key', 'dropbox'); 74 unset_config('dropbox_secret', 'dropbox'); 75 } 76 77 // Dropbox savepoint reached. 78 upgrade_plugin_savepoint(true, 2021052501, 'repository', 'dropbox'); 79 } 80 81 // Automatically generated Moodle v4.0.0 release upgrade line. 82 // Put any upgrade step following this. 83 84 return true; 85 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body