1441 |
ariadna |
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 |
global $CFG;
|
|
|
19 |
require_once($CFG->dirroot . '/mod/qbank/backup/moodle2/restore_qbank_stepslib.php');
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* The task that provides a complete restore of mod_qbank.
|
|
|
23 |
*
|
|
|
24 |
* @package mod_qbank
|
|
|
25 |
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
|
|
|
26 |
* @author Simon Adams <simon.adams@catalyst-eu.net>
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
*/
|
|
|
29 |
class restore_qbank_activity_task extends restore_activity_task {
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* Defines particular settings that this activity can have.
|
|
|
33 |
*/
|
|
|
34 |
protected function define_my_settings(): void {
|
|
|
35 |
// No particular settings for this activity.
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* Defines particular steps that this activity can have.
|
|
|
40 |
*
|
|
|
41 |
* @return void.
|
|
|
42 |
*/
|
|
|
43 |
protected function define_my_steps(): void {
|
|
|
44 |
// Qbank only has one structure step.
|
|
|
45 |
$this->add_step(new restore_qbank_activity_structure_step('qbank_structure', 'qbank.xml'));
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Defines the contents in the activity that must be processed by the link decoder.
|
|
|
50 |
*
|
|
|
51 |
* @return array.
|
|
|
52 |
*/
|
|
|
53 |
public static function define_decode_contents(): array {
|
|
|
54 |
return [];
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Defines the decoding rules for links belonging to the activity to be executed by the link decoder.
|
|
|
59 |
*
|
|
|
60 |
* @return restore_decode_rule[].
|
|
|
61 |
*/
|
|
|
62 |
public static function define_decode_rules(): array {
|
|
|
63 |
$rules = [];
|
|
|
64 |
|
|
|
65 |
$rules[] = new restore_decode_rule('QBANKVIEWBYID', '/mod/qbank/view.php?id=$1', 'course_module');
|
|
|
66 |
|
|
|
67 |
return $rules;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
/**
|
|
|
71 |
* Defines the restore log rules that will be applied by the
|
|
|
72 |
* {@see restore_logs_processor} when restoring mod_qbank logs. It
|
|
|
73 |
* must return one array of {@see restore_log_rule} objects.
|
|
|
74 |
*
|
|
|
75 |
* @return restore_log_rule[].
|
|
|
76 |
*/
|
|
|
77 |
public static function define_restore_log_rules(): array {
|
|
|
78 |
return [];
|
|
|
79 |
}
|
|
|
80 |
}
|