See Release Notes
Long Term Support Release
Differences Between: [Versions 401 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 /** 18 * Class for the structure used for restore BigBlueButtonBN. 19 * 20 * @package mod_bigbluebuttonbn 21 * @copyright 2010 onwards, Blindside Networks Inc 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 * @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com) 24 * @author Jesus Federico (jesus [at] blindsidenetworks [dt] com) 25 */ 26 27 /** 28 * Define all the restore steps that will be used by the restore_url_activity_task. 29 * 30 * @package mod_bigbluebuttonbn 31 * @copyright 2010 onwards, Blindside Networks Inc 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class restore_bigbluebuttonbn_activity_structure_step extends restore_activity_structure_step { 35 /** 36 * Structure step to restore one bigbluebuttonbn activity. 37 * 38 * @return array 39 */ 40 protected function define_structure() { 41 $paths = []; 42 $paths[] = new restore_path_element('bigbluebuttonbn', '/activity/bigbluebuttonbn'); 43 $paths[] = new restore_path_element('bigbluebuttonbn_logs', '/activity/bigbluebuttonbn/logs/log'); 44 $paths[] = new restore_path_element('bigbluebuttonbn_recordings', '/activity/bigbluebuttonbn/recordings/recording'); 45 // Return the paths wrapped into standard activity structure. 46 return $this->prepare_activity_structure($paths); 47 } 48 49 /** 50 * Process a bigbluebuttonbn restore. 51 * 52 * @param array $data The data in object form 53 * @return void 54 */ 55 protected function process_bigbluebuttonbn(array $data) { 56 global $DB; 57 $data = (object) $data; 58 $data->course = $this->get_courseid(); 59 $data->timemodified = $this->apply_date_offset($data->timemodified); 60 // Check if we are in backup::MODE_IMPORT (we set a new meetingid) or backup::MODE_GENERAL (we keep the same meetingid). 61 if ($this->get_task()->get_info()->mode == backup::MODE_IMPORT || empty($data->meetingid)) { 62 // We are in backup::MODE_IMPORT, we need to renew the meetingid. 63 $data->meetingid = \mod_bigbluebuttonbn\meeting::get_unique_meetingid_seed(); 64 } 65 // Insert the bigbluebuttonbn record. 66 $newitemid = $DB->insert_record('bigbluebuttonbn', $data); 67 // Immediately after inserting "activity" record, call this. 68 $this->apply_activity_instance($newitemid); 69 } 70 71 /** 72 * Process a bigbluebuttonbn_logs restore (additional table). 73 * 74 * @param array $data The data in object form 75 * @return void 76 */ 77 protected function process_bigbluebuttonbn_logs(array $data) { 78 global $DB; 79 $data = (object) $data; 80 // Apply modifications. 81 $data->courseid = $this->get_mappingid('course', $data->courseid); 82 $data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn'); 83 $data->userid = $this->get_mappingid('user', $data->userid); 84 $data->timecreated = $this->apply_date_offset($data->timecreated); 85 // Insert the bigbluebuttonbn_logs record. 86 $newitemid = $DB->insert_record('bigbluebuttonbn_logs', $data); 87 // Immediately after inserting associated record, call this. 88 $this->set_mapping('bigbluebuttonbn_logs', $data->id, $newitemid); 89 } 90 91 /** 92 * Process a bigbluebuttonbn_recordings restore (additional table). 93 * 94 * @param array $data The data in object form 95 * @return void 96 */ 97 protected function process_bigbluebuttonbn_recordings(array $data) { 98 global $DB; 99 $data = (object) $data; 100 // Apply modifications. 101 $data->courseid = $this->get_mappingid('course', $data->courseid); 102 $data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn'); 103 $data->timecreated = $this->apply_date_offset($data->timecreated); 104 // Insert the bigbluebuttonbn_recordings record. 105 $newitemid = $DB->insert_record('bigbluebuttonbn_recordings', $data); 106 // Immediately after inserting associated record, call this. 107 $this->set_mapping('bigbluebuttonbn_recordings', $data->id, $newitemid); 108 } 109 110 /** 111 * Actions to be executed after the restore is completed 112 * 113 * @return void 114 */ 115 protected function after_execute() { 116 // Add bigbluebuttonbn related files, no need to match by itemname (just internally handled context). 117 $this->add_related_files('mod_bigbluebuttonbn', 'intro', null); 118 } 119 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body