MDL-81172 Backup: Async Backup on by default from install

Enable asynchronous backup and restore on new site install.
Existing behaviour is not changed for sites being upgraded.
Behat tests have been set to use synchronous mode.
This commit is contained in:
Matt Porritt
2024-03-18 12:01:50 +11:00
parent 757be30c39
commit 5d74f366a0
26 changed files with 68 additions and 2 deletions
+2
View File
@@ -4504,6 +4504,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+2 -2
View File
@@ -727,12 +727,12 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp = new admin_settingpage('asyncgeneralsettings', new lang_string('asyncgeneralsettings', 'backup'));
$temp->add(new admin_setting_configcheckbox('enableasyncbackup', new lang_string('enableasyncbackup', 'backup'),
new lang_string('enableasyncbackup_help', 'backup'), 0, 1, 0));
new lang_string('enableasyncbackup_help', 'backup'), 1, 1, 0));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_async_message_users',
new lang_string('asyncemailenable', 'backup'),
new lang_string('asyncemailenabledetail', 'backup'), 0));
new lang_string('asyncemailenabledetail', 'backup'), 1));
$temp->hide_if('backup/backup_async_message_users', 'enableasyncbackup');
$temp->add(new admin_setting_configtext(
@@ -5,6 +5,8 @@ Feature: Backup and restore of the question that was tagged
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript @_file_upload
Scenario: Restore the quiz containing the question that was tagged
@@ -13,6 +13,8 @@ Feature: Backup Moodle courses
| activity | course | idnumber | name | intro | section |
| assign | C2 | assign1 | Test assign | Assign description | 1 |
| data | C2 | data1 | Test data | Database description | 2 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
Scenario: Backup a course providing options
@@ -19,6 +19,8 @@ Feature: Backup xAPI states
| course | C1 |
| name | Awesome H5P package |
| packagefilepath | h5p/tests/fixtures/filltheblanks.h5p |
And the following config values are set as admin:
| enableasyncbackup | 0 |
# Save state for the student user.
And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
And I switch to "h5p-player" class iframe
@@ -24,6 +24,8 @@ Feature: Restore Moodle 2 course backups
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| activity_modules | Course | C1 | course-view-* | side-pre |
| activity_modules | Course | C5 | course-view-* | side-pre |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
@@ -32,6 +32,8 @@ Feature: Restore Moodle 2 course backups with different user data settings
And the following "mod_data > entries" exist:
| database | user | Test field name |
| data1 | student1 | Student entry |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
And I backup "Course 1" course using this options:
| Initial | Include enrolled users | 1 |
@@ -26,6 +26,8 @@ Feature: Backup and restore the activity with the completion
| completionusegrade | 1 |
| gradepass | 50 |
| completionpassgrade | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I log out
@@ -31,6 +31,8 @@ Feature: Enrolments are synchronised with meta courses
| student2 | C2C2 | student | 0 |
| student1 | C4C4 | student | 0 |
| student2 | C4C4 | student | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
And I click on "Enable" "link" in the "Course meta link" "table_row"
@@ -22,6 +22,8 @@ Feature: Backup and restore a course containing groups
| Not visible | C1 | N | 3 | 0 |
| Visible/Non-Participation | C1 | VN | 0 | 0 |
| Only visible to members/Non-Participation | C1 | MN | 1 | 0 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz |
+18
View File
@@ -2898,3 +2898,21 @@ function check_oracle_usage(environment_results $result): ?environment_results {
return null;
}
/**
* Check if asynchronous backups are enabled.
*
* @param environment_results $result
* @return environment_results|null
*/
function check_async_backup(environment_results $result): ?environment_results {
global $CFG;
if (!during_initial_install() && empty($CFG->enableasyncbackup)) { // Have to use $CFG as config table may not be available.
$result->setInfo('Asynchronous backups disabled');
$result->setFeedbackStr('asyncbackupdisabled');
return $result;
}
return null;
}
@@ -12,6 +12,8 @@ Feature: BigBlueButtonBN Subplugins test
And the following "activities" exist:
| activity | course | name | type |
| bigbluebuttonbn | Test course | BBB Instance name | 0 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
Scenario: Add a subplugin and check that the settings are available
Given I log in as "admin"
@@ -13,6 +13,8 @@ Feature: Restoring Moodle 2 backup restores LTI configuration
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
And the following config values are set as admin:
| enableasyncbackup | 0 |
Scenario: Backup and restore course with preconfigured site LTI tool on the same site
Given the following "mod_lti > tool types" exist:
@@ -17,6 +17,8 @@ Feature: Manage course tools
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following config values are set as admin:
| enableasyncbackup | 0 |
Scenario: Create a course tool from the zero state
Given I am on the "Course 1" course page logged in as teacher1
+2
View File
@@ -11,6 +11,8 @@ Feature: Backup and restore of quizzes
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
@javascript
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a drag and drop onto image question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| Drag onto image | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a drag and drop onto image question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a drag and drop markers question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| Drag markers | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a drag and drop into text question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| Drag to text | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a drag and drop into text question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a Description question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| description-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a Description question
@@ -23,6 +23,8 @@ Feature: Test duplicating a quiz containing an Essay question
| essay-001 | 1 |
| essay-002 | 1 |
| essay-003 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing 3 Essay questions
@@ -13,6 +13,8 @@ Feature: Test all the basic functionality of this question type
And the following "course enrolments" exist:
| user | course | role |
| teacher | C1 | editingteacher |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Create, edit then preview a gapselect question.
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a Matching question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| matching-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a Matching question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a Multiple choice question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| Multi-choice-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a Multiple choice question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a Numerical question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| Numerical-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a Numerical question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a Short answer question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| shortanswer-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a Short answer question
@@ -19,6 +19,8 @@ Feature: Test duplicating a quiz containing a True/False question
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| true-false-001 | 1 |
And the following config values are set as admin:
| enableasyncbackup | 0 |
@javascript
Scenario: Backup and restore a course containing a True/False question