MDL-75708 reportbuilder: consider stress tests as requiring longtest.
[moodle.git] / backup / moodle2 / backup_settingslib.php
blobca9224f17071d6b145d9f6df6600bf0a5754ada5
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Defines classes used to handle backup settings
21 * @package core_backup
22 * @subpackage moodle2
23 * @category backup
24 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28 // TODO: Reduce these to the minimum because ui/dependencies are 100% separated
30 // Root backup settings
32 /**
33 * root generic setting to store different things without dependencies
35 class backup_generic_setting extends root_backup_setting {}
37 /**
38 * root setting to handle backup file names (no dependencies nor anything else)
40 class backup_filename_setting extends backup_generic_setting {
42 /**
43 * Instantiates a setting object
45 * @param string $name Name of the setting
46 * @param string $vtype Type of the setting, eg {@link base_setting::IS_TEXT}
47 * @param mixed $value Value of the setting
48 * @param bool $visibility Is the setting visible in the UI, eg {@link base_setting::VISIBLE}
49 * @param int $status Status of the setting with regards to the locking, eg {@link base_setting::NOT_LOCKED}
51 public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
52 parent::__construct($name, $vtype, $value, $visibility, $status);
55 public function set_ui_filename($label, $value, array $options = null) {
56 $this->make_ui(self::UI_HTML_TEXTFIELD, $label, null, $options);
57 $this->set_value($value);
61 /**
62 * root setting to control if backup will include user information
63 * A lot of other settings are dependent of this (module's user info,
64 * grades user info, messages, blogs...
66 class backup_users_setting extends backup_generic_setting {}
68 /**
69 * root setting to control if backup will include permission information by roles
71 class backup_permissions_setting extends backup_generic_setting {
74 /**
75 * root setting to control if backup will include group information depends on @backup_users_setting
77 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
78 * @copyright 2014 Matt Sammarco
80 class backup_groups_setting extends backup_generic_setting {
83 /**
84 * root setting to control if backup will include custom field information
86 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
87 * @copyright 2018 Daniel Neis Araujo
89 class backup_customfield_setting extends backup_generic_setting {
92 /**
93 * root setting to control if backup will include activities or no.
94 * A lot of other settings (_included at activity levels)
95 * are dependent of this setting
97 class backup_activities_setting extends backup_generic_setting {}
99 /**
100 * root setting to control if backup will generate anonymized
101 * user info or no, depends of @backup_users_setting so only is
102 * available if the former is enabled (apart from security
103 * that can change it
105 class backup_anonymize_setting extends root_backup_setting {}
108 * root setting to control if backup will include
109 * role assignments or no (any level), depends of @backup_users_setting
110 * exactly in the same way than @backup_anonymize_setting so we extend from it
112 class backup_role_assignments_setting extends backup_anonymize_setting {}
115 * root setting to control if backup will include
116 * logs or no (any level), depends of @backup_users_setting
117 * exactly in the same way than @backup_anonymize_setting so we extend from it
119 class backup_logs_setting extends backup_anonymize_setting {}
122 * root setting to control if backup will include
123 * comments or no (any level), depends of @backup_users_setting
124 * exactly in the same way than @backup_anonymize_setting so we extend from it
126 class backup_comments_setting extends backup_anonymize_setting {}
129 * root setting to control if backup will include badges or not,
130 * depends on @backup_activities_setting
132 class backup_badges_setting extends backup_generic_setting {}
135 * root setting to control if backup will include
136 * calender events or no (any level), depends of @backup_users_setting
137 * exactly in the same way than @backup_anonymize_setting so we extend from it
139 class backup_calendarevents_setting extends backup_anonymize_setting {}
142 * root setting to control if backup will include
143 * users completion data or no (any level), depends of @backup_users_setting
144 * exactly in the same way than @backup_anonymize_setting so we extend from it
146 class backup_userscompletion_setting extends backup_anonymize_setting {}
149 * root setting to control if backup will include competencies or not.
151 class backup_competencies_setting extends backup_generic_setting {
154 * backup_competencies_setting constructor.
156 public function __construct() {
157 $defaultvalue = false;
158 $visibility = base_setting::HIDDEN;
159 $status = base_setting::LOCKED_BY_CONFIG;
160 if (\core_competency\api::is_enabled()) {
161 $defaultvalue = true;
162 $visibility = base_setting::VISIBLE;
163 $status = base_setting::NOT_LOCKED;
165 parent::__construct('competencies', base_setting::IS_BOOLEAN, $defaultvalue, $visibility, $status);
169 // Section backup settings
172 * generic section setting to pass various settings between tasks and steps
174 class backup_section_generic_setting extends section_backup_setting {}
177 * Setting to define if one section is included or no. Activities _included
178 * settings depend of them if available
180 class backup_section_included_setting extends section_backup_setting {}
183 * section backup setting to control if section will include
184 * user information or no, depends of @backup_users_setting
186 class backup_section_userinfo_setting extends section_backup_setting {}
189 // Activity backup settings
192 * generic activity setting to pass various settings between tasks and steps
194 class backup_activity_generic_setting extends activity_backup_setting {}
197 * activity backup setting to control if activity will
198 * be included or no, depends of @backup_activities_setting and
199 * optionally parent section included setting
201 class backup_activity_included_setting extends activity_backup_setting {}
204 * activity backup setting to control if activity will include
205 * user information or no, depends of @backup_users_setting
207 class backup_activity_userinfo_setting extends activity_backup_setting {}
210 * Root setting to control if backup will include content bank content or no
212 class backup_contentbankcontent_setting extends backup_generic_setting {