-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpatch_401_class_renames.php
62 lines (55 loc) · 2.41 KB
/
patch_401_class_renames.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* Patch renamed classes for Moodle 4.1 and below.
*
* @see https://moodledev.io/docs/4.2/devupdate
*
* @package quiz_archiver
* @copyright 2025 Niels Gandraß <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// @codingStandardsIgnoreLine
defined('MOODLE_INTERNAL') || die(); // @codeCoverageIgnore
global $CFG;
if ($CFG->branch <= 401) {
require_once($CFG->dirroot.'/mod/quiz/locallib.php');
require_once($CFG->dirroot.'/lib/external/externallib.php');
// Patch renamed classes.
foreach ([
// External API.
'external_api' => 'core_external\external_api',
'external_description' => 'core_external\external_description',
'external_files' => 'core_external\files',
'external_format_value' => 'core_external\external_format_value',
'external_function_parameters' => 'core_external\external_function_parameters',
'external_multiple_structure' => 'core_external\external_multiple_structure',
'external_settings' => 'core_external\external_settings',
'external_single_structure' => 'core_external\external_single_structure',
'external_util' => 'core_external\util',
'external_value' => 'core_external\external_value',
'external_warnings' => 'core_external\external_warnings',
'restricted_context_exception' => 'core_external\restricted_context_exception',
// Module: mod_quiz.
'quiz_default_report' => 'mod_quiz\local\reports\report_base',
'quiz_attempt' => 'mod_quiz\quiz_attempt',
'mod_quiz_display_options' => 'mod_quiz\question\display_options',
] as $old => $new) {
if (class_exists($old)) {
class_alias($old, $new);
}
}
}