Skip to content

Commit 213dc29

Browse files
authored
Merge pull request #86 from ctam/UCSFCLE_403-Update_to_Moodle_4.3.8
Update to Moodle 4.3.8
2 parents 338bc4a + dce07d9 commit 213dc29

File tree

818 files changed

+14381
-19236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

818 files changed

+14381
-19236
lines changed

admin/renderer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,8 @@ public function warn_if_not_registered() {
874874
protected function mobile_configuration_warning($mobileconfigured) {
875875
$output = '';
876876
if (!$mobileconfigured) {
877-
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
878-
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'));
877+
$settingslink = new moodle_url('/admin/search.php', ['query' => 'enablemobilewebservice']);
878+
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'), 'get');
879879
$output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . ' ' . $configurebutton);
880880
}
881881

admin/tool/admin_presets/tests/behat/download.feature

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ Feature: I can download a preset
55
| name |
66
| Custom preset |
77

8-
@javascript
98
Scenario: Custom preset settings can be downloaded
109
Given I log in as "admin"
1110
And I navigate to "Site admin presets" in site administration
1211
When I open the action menu in "Custom preset" "table_row"
13-
Then following "Download" "link" in the "Custom preset" "table_row" should download between "0" and "5000" bytes
12+
Then following "Download" in the "Custom preset" "table_row" should download a file that:
13+
| Has mimetype | text/xml |
14+
| Contains text in xml element | Custom preset |
1415

15-
@javascript
1616
Scenario: Core preset settings can be downloaded
1717
Given I log in as "admin"
1818
And I navigate to "Site admin presets" in site administration
1919
When I open the action menu in "Starter" "table_row"
20-
Then following "Download" "link" in the "Starter" "table_row" should download between "0" and "5000" bytes
20+
Then following "Download" in the "Starter" "table_row" should download a file that:
21+
| Has mimetype | text/xml |
22+
| Contains text in xml element | Starter |

admin/tool/behat/tests/behat/tabs.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Feature: Confirm that we can open multiple browser tabs
2525
And I open a tab named "CourseViewer4" on the "My courses" page
2626

2727
# Switch between all the tabs and confirm their different contents.
28-
Then I should see "You're not enrolled in any course"
28+
Then I should see "You're not enrolled in any courses."
2929
And I switch to "CourseViewer2" tab
3030
And "Course 3" "heading" should exist
3131
And I switch to "CourseViewer1" tab

admin/tool/dataprivacy/tests/behat/dataexport.feature

+12-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ Feature: Data export from the privacy API
5555
And I reload the page
5656
And I should see "Download ready" in the "Victim User 1" "table_row"
5757
And I open the action menu in "Victim User 1" "table_row"
58-
And following "Download" should download between "1" and "200000" bytes
58+
And following "Download" should download a file that:
59+
| Contains file in zip | index.html |
5960
And the following config values are set as admin:
6061
| privacyrequestexpiry | 1 | tool_dataprivacy |
6162
And I wait "1" seconds
@@ -90,7 +91,8 @@ Feature: Data export from the privacy API
9091
And I reload the page
9192
And I should see "Download ready" in the "Export all of my personal data" "table_row"
9293
And I open the action menu in "Victim User 1" "table_row"
93-
And following "Download" should download between "1" and "200000" bytes
94+
And following "Download" should download a file that:
95+
| Contains file in zip | index.html |
9496

9597
And the following config values are set as admin:
9698
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -128,7 +130,8 @@ Feature: Data export from the privacy API
128130
And I reload the page
129131
And I should see "Download ready" in the "Victim User 1" "table_row"
130132
And I open the action menu in "Victim User 1" "table_row"
131-
And following "Download" should download between "1" and "200000" bytes
133+
And following "Download" should download a file that:
134+
| Contains file in zip | index.html |
132135

133136
And the following config values are set as admin:
134137
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -187,7 +190,8 @@ Feature: Data export from the privacy API
187190
And I reload the page
188191
And I should see "Download ready" in the "Victim User 1" "table_row"
189192
And I open the action menu in "Victim User 1" "table_row"
190-
And following "Download" should download between "1" and "172000" bytes
193+
And following "Download" should download a file that:
194+
| Contains file in zip | index.html |
191195
And the following config values are set as admin:
192196
| privacyrequestexpiry | 1 | tool_dataprivacy |
193197
And I wait "1" seconds
@@ -231,7 +235,8 @@ Feature: Data export from the privacy API
231235
And I reload the page
232236
And I should see "Download ready" in the "Victim User 1" "table_row"
233237
And I open the action menu in "Victim User 1" "table_row"
234-
And following "Download" should download between "1" and "180000" bytes
238+
And following "Download" should download a file that:
239+
| Contains file in zip | index.html |
235240

236241
@javascript
237242
Scenario: Filter before export data for a user and download it in the view request action
@@ -264,4 +269,5 @@ Feature: Data export from the privacy API
264269
And I reload the page
265270
And I should see "Download ready" in the "Victim User 1" "table_row"
266271
And I open the action menu in "Victim User 1" "table_row"
267-
And following "Download" should download between "1" and "180000" bytes
272+
And following "Download" should download a file that:
273+
| Contains file in zip | index.html |

admin/tool/recyclebin/classes/category_bin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function store_item($course) {
117117
// This hack will be removed once recycle bin switches to use its own backup mode, with
118118
// own preferences and 100% separate from MOODLE_AUTOMATED.
119119
// TODO: Remove this as part of MDL-65228.
120-
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
120+
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? [];
121121
$CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
122122
$CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;
123123

@@ -253,7 +253,7 @@ public function restore_item($item) {
253253
// This hack will be removed once recycle bin switches to use its own backup mode, with
254254
// own preferences and 100% separate from MOODLE_AUTOMATED.
255255
// TODO: Remove this as part of MDL-65228.
256-
$forcedrestoresettings = $CFG->forced_plugin_settings['restore'] ?? null;
256+
$forcedrestoresettings = $CFG->forced_plugin_settings['restore'] ?? [];
257257
$CFG->forced_plugin_settings['restore']['restore_general_users'] = 1;
258258
$CFG->forced_plugin_settings['restore']['restore_general_groups'] = 1;
259259

admin/tool/recyclebin/classes/course_bin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function store_item($cm) {
121121
// This hack will be removed once recycle bin switches to use its own backup mode, with
122122
// own preferences and 100% separate from MOODLE_AUTOMATED.
123123
// TODO: Remove this as part of MDL-65228.
124-
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
124+
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? [];
125125
$CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
126126
$CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;
127127

admin/tool/usertours/classes/step.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ protected function calculate_sortorder() {
572572
* @return $this
573573
*/
574574
public function persist($force = false) {
575-
global $DB;
575+
global $CFG, $DB;
576+
require_once("{$CFG->libdir}/filelib.php");
576577

577578
if (!$this->dirty && !$force) {
578579
return $this;
@@ -729,6 +730,9 @@ public function add_config_field_to_form(\MoodleQuickForm $mform, $key) {
729730
* @return object
730731
*/
731732
public function prepare_data_for_form() {
733+
global $CFG;
734+
require_once("{$CFG->libdir}/filelib.php");
735+
732736
$data = $this->to_record();
733737
foreach (self::get_config_keys() as $key) {
734738
$data->$key = $this->get_config($key, configuration::get_step_default_value($key));

analytics/tests/behat/manage_models.feature

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ Feature: Manage analytics models
146146
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
147147
And I choose "Export" in the open action menu
148148
And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
149-
And following "Export" should download between "100" and "500" bytes
149+
And following "Export" should download a file that:
150+
| Contains file in zip | model-config.json |
150151

151152
Scenario: Check invalid site elements
152153
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"

backup/moodle2/backup_stepslib.php

+37-14
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,12 @@ protected function define_structure() {
552552
FROM {course_format_options}
553553
WHERE courseid = ? AND sectionid = 0', [ backup::VAR_PARENTID ]);
554554

555-
$handler = core_course\customfield\course_handler::create();
556-
$fieldsforbackup = $handler->get_instance_data_for_backup($this->task->get_courseid());
557-
$customfield->set_source_array($fieldsforbackup);
555+
// Custom fields.
556+
if ($this->get_setting_value('customfield')) {
557+
$handler = core_course\customfield\course_handler::create();
558+
$fieldsforbackup = $handler->get_instance_data_for_backup($this->task->get_courseid());
559+
$customfield->set_source_array($fieldsforbackup);
560+
}
558561

559562
// Some annotations
560563

@@ -1403,24 +1406,40 @@ protected function define_structure() {
14031406
FROM {groups} g
14041407
JOIN {backup_ids_temp} bi ON g.id = bi.itemid
14051408
WHERE bi.backupid = ?
1406-
AND bi.itemname = 'groupfinal'", array(backup::VAR_BACKUPID));
1409+
AND bi.itemname = 'groupfinal'",
1410+
[backup_helper::is_sqlparam($this->get_backupid())]
1411+
);
14071412

14081413
$grouping->set_source_sql("
14091414
SELECT g.*
14101415
FROM {groupings} g
14111416
JOIN {backup_ids_temp} bi ON g.id = bi.itemid
14121417
WHERE bi.backupid = ?
1413-
AND bi.itemname = 'groupingfinal'", array(backup::VAR_BACKUPID));
1418+
AND bi.itemname = 'groupingfinal'",
1419+
[backup_helper::is_sqlparam($this->get_backupid())]
1420+
);
1421+
14141422
$groupinggroup->set_source_table('groupings_groups', array('groupingid' => backup::VAR_PARENTID));
14151423

14161424
// This only happens if we are including users.
14171425
if ($userinfo) {
14181426
$member->set_source_table('groups_members', array('groupid' => backup::VAR_PARENTID));
14191427
}
14201428

1421-
$courseid = $this->task->get_courseid();
1422-
$groupcustomfield->set_source_array($this->get_group_custom_fields_for_backup($courseid));
1423-
$groupingcustomfield->set_source_array($this->get_grouping_custom_fields_for_backup($courseid));
1429+
// Custom fields.
1430+
if ($this->get_setting_value('customfield')) {
1431+
$groupcustomfieldarray = $this->get_group_custom_fields_for_backup(
1432+
$group->get_source_sql(),
1433+
[$this->get_backupid()]
1434+
);
1435+
$groupcustomfield->set_source_array($groupcustomfieldarray);
1436+
1437+
$groupingcustomfieldarray = $this->get_grouping_custom_fields_for_backup(
1438+
$grouping->get_source_sql(),
1439+
[$this->get_backupid()]
1440+
);
1441+
$groupingcustomfield->set_source_array($groupingcustomfieldarray);
1442+
}
14241443
}
14251444

14261445
// Define id annotations (as final)
@@ -1439,14 +1458,16 @@ protected function define_structure() {
14391458

14401459
/**
14411460
* Get custom fields array for group
1442-
* @param int $courseid
1461+
*
1462+
* @param string $groupsourcesql
1463+
* @param array $groupsourceparams
14431464
* @return array
14441465
*/
1445-
protected function get_group_custom_fields_for_backup(int $courseid): array {
1466+
protected function get_group_custom_fields_for_backup(string $groupsourcesql, array $groupsourceparams): array {
14461467
global $DB;
14471468
$handler = \core_group\customfield\group_handler::create();
14481469
$fieldsforbackup = [];
1449-
if ($groups = $DB->get_records('groups', ['courseid' => $courseid], '', 'id')) {
1470+
if ($groups = $DB->get_records_sql($groupsourcesql, $groupsourceparams)) {
14501471
foreach ($groups as $group) {
14511472
$fieldsforbackup = array_merge($fieldsforbackup, $handler->get_instance_data_for_backup($group->id));
14521473
}
@@ -1456,14 +1477,16 @@ protected function get_group_custom_fields_for_backup(int $courseid): array {
14561477

14571478
/**
14581479
* Get custom fields array for grouping
1459-
* @param int $courseid
1480+
*
1481+
* @param string $groupingsourcesql
1482+
* @param array $groupingsourceparams
14601483
* @return array
14611484
*/
1462-
protected function get_grouping_custom_fields_for_backup(int $courseid): array {
1485+
protected function get_grouping_custom_fields_for_backup(string $groupingsourcesql, array $groupingsourceparams): array {
14631486
global $DB;
14641487
$handler = \core_group\customfield\grouping_handler::create();
14651488
$fieldsforbackup = [];
1466-
if ($groupings = $DB->get_records('groupings', ['courseid' => $courseid], '', 'id')) {
1489+
if ($groupings = $DB->get_records_sql($groupingsourcesql, $groupingsourceparams)) {
14671490
foreach ($groupings as $grouping) {
14681491
$fieldsforbackup = array_merge($fieldsforbackup, $handler->get_instance_data_for_backup($grouping->id));
14691492
}

backup/moodle2/restore_root_task.class.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,16 @@ protected function define_settings() {
300300
$competencies->set_ui(new backup_setting_ui_checkbox($competencies, get_string('rootsettingcompetencies', 'backup')));
301301
$this->add_setting($competencies);
302302

303-
$customfields = new restore_customfield_setting('customfields', base_setting::IS_BOOLEAN, $defaultvalue);
303+
// Custom fields.
304+
$defaultvalue = false;
305+
$changeable = false;
306+
if (isset($rootsettings['customfield']) && $rootsettings['customfield']) { // Only enabled when available.
307+
$defaultvalue = true;
308+
$changeable = true;
309+
}
310+
$customfields = new restore_customfield_setting('customfield', base_setting::IS_BOOLEAN, $defaultvalue);
304311
$customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup')));
312+
$customfields->get_ui()->set_changeable($changeable);
305313
$this->add_setting($customfields);
306314

307315
// Define Content bank content.

0 commit comments

Comments
 (0)