Merge branch 'MDL-66873-main' of https://github.com/meirzamoodle/moodle
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
issueNumber: MDL-66873
|
||||
notes:
|
||||
core_backup:
|
||||
- message: Remove all MODE_HUB related code.
|
||||
type: removed
|
||||
@@ -64,7 +64,6 @@ abstract class backup implements checksumable {
|
||||
* during a restore they are copied from the existing file record.
|
||||
*/
|
||||
const MODE_IMPORT = 20;
|
||||
const MODE_HUB = 30;
|
||||
|
||||
/**
|
||||
* This mode is intended for duplicating courses and cases where the backup target is
|
||||
|
||||
@@ -144,7 +144,7 @@ class backup_controller extends base_controller {
|
||||
* @param int $id The ID of the item to backup; e.g the course id
|
||||
* @param string $format The backup format to use; Most likely backup::FORMAT_MOODLE
|
||||
* @param bool $interactive Whether this backup will require user interaction; backup::INTERACTIVE_YES or INTERACTIVE_NO
|
||||
* @param int $mode One of backup::MODE_GENERAL, MODE_IMPORT, MODE_SAMESITE, MODE_HUB, MODE_AUTOMATED
|
||||
* @param int $mode One of backup::MODE_GENERAL, MODE_IMPORT, MODE_SAMESITE, MODE_AUTOMATED
|
||||
* @param int $userid The id of the user making the backup
|
||||
* @param bool $releasesession Should release the session? backup::RELEASESESSION_YES or backup::RELEASESESSION_NO
|
||||
*/
|
||||
|
||||
@@ -76,7 +76,7 @@ class backup_course_task extends backup_task {
|
||||
$this->add_step(new backup_course_structure_step('course_info', 'course.xml'));
|
||||
|
||||
// Generate the enrolment file (conditionally, prevent it in any IMPORT/HUB operation)
|
||||
if ($this->plan->get_mode() != backup::MODE_IMPORT && $this->plan->get_mode() != backup::MODE_HUB) {
|
||||
if ($this->plan->get_mode() != backup::MODE_IMPORT) {
|
||||
$this->add_step(new backup_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ class restore_course_task extends restore_task {
|
||||
if ($this->plan->get_mode() == backup::MODE_IMPORT) {
|
||||
// No need to do anything with enrolments.
|
||||
|
||||
} else if (!$this->get_setting_value('users') or $this->plan->get_mode() == backup::MODE_HUB) {
|
||||
if ($this->get_setting_value('enrolments') == backup::ENROL_ALWAYS && $this->plan->get_mode() != backup::MODE_HUB) {
|
||||
} else if (!$this->get_setting_value('users')) {
|
||||
if ($this->get_setting_value('enrolments') == backup::ENROL_ALWAYS) {
|
||||
// Restore enrolment methods.
|
||||
$this->add_step(new restore_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
} else if ($this->get_target() == backup::TARGET_CURRENT_ADDING or $this->get_target() == backup::TARGET_EXISTING_ADDING) {
|
||||
|
||||
@@ -206,7 +206,7 @@ abstract class backup_check {
|
||||
|
||||
// Now, if mode is HUB or IMPORT, and still we are including users in backup, turn them off
|
||||
// Defaults processing should have handled this, but we need to be 100% sure
|
||||
if ($mode == backup::MODE_IMPORT || $mode == backup::MODE_HUB) {
|
||||
if ($mode == backup::MODE_IMPORT) {
|
||||
$userssetting = $backup_controller->get_plan()->get_setting('users');
|
||||
if ($userssetting->get_value()) {
|
||||
$userssetting->set_value(false); // Set the value to false
|
||||
|
||||
@@ -138,7 +138,7 @@ abstract class restore_check {
|
||||
|
||||
// Now, if mode is HUB or IMPORT, and still we are including users in restore, turn them off
|
||||
// Defaults processing should have handled this, but we need to be 100% sure
|
||||
if ($mode == backup::MODE_IMPORT || $mode == backup::MODE_HUB) {
|
||||
if ($mode == backup::MODE_IMPORT) {
|
||||
$userssetting = $restore_controller->get_plan()->get_setting('users');
|
||||
if ($userssetting->get_value()) {
|
||||
$userssetting->set_value(false); // Set the value to false
|
||||
|
||||
@@ -317,16 +317,6 @@ abstract class backup_helper {
|
||||
}
|
||||
}
|
||||
|
||||
// Backups of type HUB (by definition never have user info)
|
||||
// are sent to user's "user_tohub" file area. The upload process
|
||||
// will be responsible for cleaning that filearea once finished
|
||||
if ($backupmode == backup::MODE_HUB) {
|
||||
$ctxid = context_user::instance($userid)->id;
|
||||
$component = 'user';
|
||||
$filearea = 'tohub';
|
||||
$itemid = 0;
|
||||
}
|
||||
|
||||
// Backups without user info or with the anonymise functionality
|
||||
// enabled are sent to user's "user_backup"
|
||||
// file area. Maintenance of such area is responsibility of
|
||||
|
||||
Reference in New Issue
Block a user