Skip to content

Commit

Permalink
Merge pull request #86 from ctam/UCSFCLE_403-Update_to_Moodle_4.3.8
Browse files Browse the repository at this point in the history
Update to Moodle 4.3.8
  • Loading branch information
ctam authored Oct 11, 2024
2 parents 338bc4a + dce07d9 commit 213dc29
Show file tree
Hide file tree
Showing 818 changed files with 14,381 additions and 19,236 deletions.
4 changes: 2 additions & 2 deletions admin/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,8 @@ public function warn_if_not_registered() {
protected function mobile_configuration_warning($mobileconfigured) {
$output = '';
if (!$mobileconfigured) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'));
$settingslink = new moodle_url('/admin/search.php', ['query' => 'enablemobilewebservice']);
$configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'), 'get');
$output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . ' ' . $configurebutton);
}

Expand Down
10 changes: 6 additions & 4 deletions admin/tool/admin_presets/tests/behat/download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ Feature: I can download a preset
| name |
| Custom preset |

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

@javascript
Scenario: Core preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Starter" "table_row"
Then following "Download" "link" in the "Starter" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Starter" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Starter |
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/tabs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feature: Confirm that we can open multiple browser tabs
And I open a tab named "CourseViewer4" on the "My courses" page

# Switch between all the tabs and confirm their different contents.
Then I should see "You're not enrolled in any course"
Then I should see "You're not enrolled in any courses."
And I switch to "CourseViewer2" tab
And "Course 3" "heading" should exist
And I switch to "CourseViewer1" tab
Expand Down
18 changes: 12 additions & 6 deletions admin/tool/dataprivacy/tests/behat/dataexport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
Expand Down Expand Up @@ -90,7 +91,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Export all of my personal data" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |

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

And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
Expand Down Expand Up @@ -187,7 +190,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "172000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
Expand Down Expand Up @@ -231,7 +235,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "180000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |

@javascript
Scenario: Filter before export data for a user and download it in the view request action
Expand Down Expand Up @@ -264,4 +269,5 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "180000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
4 changes: 2 additions & 2 deletions admin/tool/recyclebin/classes/category_bin.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function store_item($course) {
// This hack will be removed once recycle bin switches to use its own backup mode, with
// own preferences and 100% separate from MOODLE_AUTOMATED.
// TODO: Remove this as part of MDL-65228.
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? [];
$CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
$CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;

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

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/recyclebin/classes/course_bin.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function store_item($cm) {
// This hack will be removed once recycle bin switches to use its own backup mode, with
// own preferences and 100% separate from MOODLE_AUTOMATED.
// TODO: Remove this as part of MDL-65228.
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? [];
$CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
$CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;

Expand Down
6 changes: 5 additions & 1 deletion admin/tool/usertours/classes/step.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ protected function calculate_sortorder() {
* @return $this
*/
public function persist($force = false) {
global $DB;
global $CFG, $DB;
require_once("{$CFG->libdir}/filelib.php");

if (!$this->dirty && !$force) {
return $this;
Expand Down Expand Up @@ -729,6 +730,9 @@ public function add_config_field_to_form(\MoodleQuickForm $mform, $key) {
* @return object
*/
public function prepare_data_for_form() {
global $CFG;
require_once("{$CFG->libdir}/filelib.php");

$data = $this->to_record();
foreach (self::get_config_keys() as $key) {
$data->$key = $this->get_config($key, configuration::get_step_default_value($key));
Expand Down
3 changes: 2 additions & 1 deletion analytics/tests/behat/manage_models.feature
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ Feature: Manage analytics models
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
And I choose "Export" in the open action menu
And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
And following "Export" should download between "100" and "500" bytes
And following "Export" should download a file that:
| Contains file in zip | model-config.json |

Scenario: Check invalid site elements
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
Expand Down
51 changes: 37 additions & 14 deletions backup/moodle2/backup_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,12 @@ protected function define_structure() {
FROM {course_format_options}
WHERE courseid = ? AND sectionid = 0', [ backup::VAR_PARENTID ]);

$handler = core_course\customfield\course_handler::create();
$fieldsforbackup = $handler->get_instance_data_for_backup($this->task->get_courseid());
$customfield->set_source_array($fieldsforbackup);
// Custom fields.
if ($this->get_setting_value('customfield')) {
$handler = core_course\customfield\course_handler::create();
$fieldsforbackup = $handler->get_instance_data_for_backup($this->task->get_courseid());
$customfield->set_source_array($fieldsforbackup);
}

// Some annotations

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

$grouping->set_source_sql("
SELECT g.*
FROM {groupings} g
JOIN {backup_ids_temp} bi ON g.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'groupingfinal'", array(backup::VAR_BACKUPID));
AND bi.itemname = 'groupingfinal'",
[backup_helper::is_sqlparam($this->get_backupid())]
);

$groupinggroup->set_source_table('groupings_groups', array('groupingid' => backup::VAR_PARENTID));

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

$courseid = $this->task->get_courseid();
$groupcustomfield->set_source_array($this->get_group_custom_fields_for_backup($courseid));
$groupingcustomfield->set_source_array($this->get_grouping_custom_fields_for_backup($courseid));
// Custom fields.
if ($this->get_setting_value('customfield')) {
$groupcustomfieldarray = $this->get_group_custom_fields_for_backup(
$group->get_source_sql(),
[$this->get_backupid()]
);
$groupcustomfield->set_source_array($groupcustomfieldarray);

$groupingcustomfieldarray = $this->get_grouping_custom_fields_for_backup(
$grouping->get_source_sql(),
[$this->get_backupid()]
);
$groupingcustomfield->set_source_array($groupingcustomfieldarray);
}
}

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

/**
* Get custom fields array for group
* @param int $courseid
*
* @param string $groupsourcesql
* @param array $groupsourceparams
* @return array
*/
protected function get_group_custom_fields_for_backup(int $courseid): array {
protected function get_group_custom_fields_for_backup(string $groupsourcesql, array $groupsourceparams): array {
global $DB;
$handler = \core_group\customfield\group_handler::create();
$fieldsforbackup = [];
if ($groups = $DB->get_records('groups', ['courseid' => $courseid], '', 'id')) {
if ($groups = $DB->get_records_sql($groupsourcesql, $groupsourceparams)) {
foreach ($groups as $group) {
$fieldsforbackup = array_merge($fieldsforbackup, $handler->get_instance_data_for_backup($group->id));
}
Expand All @@ -1456,14 +1477,16 @@ protected function get_group_custom_fields_for_backup(int $courseid): array {

/**
* Get custom fields array for grouping
* @param int $courseid
*
* @param string $groupingsourcesql
* @param array $groupingsourceparams
* @return array
*/
protected function get_grouping_custom_fields_for_backup(int $courseid): array {
protected function get_grouping_custom_fields_for_backup(string $groupingsourcesql, array $groupingsourceparams): array {
global $DB;
$handler = \core_group\customfield\grouping_handler::create();
$fieldsforbackup = [];
if ($groupings = $DB->get_records('groupings', ['courseid' => $courseid], '', 'id')) {
if ($groupings = $DB->get_records_sql($groupingsourcesql, $groupingsourceparams)) {
foreach ($groupings as $grouping) {
$fieldsforbackup = array_merge($fieldsforbackup, $handler->get_instance_data_for_backup($grouping->id));
}
Expand Down
10 changes: 9 additions & 1 deletion backup/moodle2/restore_root_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,16 @@ protected function define_settings() {
$competencies->set_ui(new backup_setting_ui_checkbox($competencies, get_string('rootsettingcompetencies', 'backup')));
$this->add_setting($competencies);

$customfields = new restore_customfield_setting('customfields', base_setting::IS_BOOLEAN, $defaultvalue);
// Custom fields.
$defaultvalue = false;
$changeable = false;
if (isset($rootsettings['customfield']) && $rootsettings['customfield']) { // Only enabled when available.
$defaultvalue = true;
$changeable = true;
}
$customfields = new restore_customfield_setting('customfield', base_setting::IS_BOOLEAN, $defaultvalue);
$customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup')));
$customfields->get_ui()->set_changeable($changeable);
$this->add_setting($customfields);

// Define Content bank content.
Expand Down
Loading

0 comments on commit 213dc29

Please sign in to comment.