MDL-75025 backup: Final deprecation of base_controller::get/set_copy

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
Daniel Ziegenberg 2024-03-27 21:58:00 +01:00
parent ad7fc69c25
commit 8723c4099b
No known key found for this signature in database
GPG Key ID: 7E6F98FFADBEFD39
3 changed files with 21 additions and 28 deletions

View File

@ -0,0 +1,7 @@
issueNumber: MDL-75025
notes:
core_backup:
- message: >-
Final deprecation of base_controller::get_copy(). Please use
restore_controller::get_copy() instead.
type: removed

View File

@ -0,0 +1,6 @@
issueNumber: MDL-75025
notes:
core_backup:
- message: 'Final deprecation of base_controller::set_copy(). Please use a restore
controller for storing copy information instead.'
type: removed

View File

@ -107,38 +107,18 @@ abstract class base_controller extends backup implements loggable {
}
/**
* Store extra data for course copy operations.
*
* For a course copying these is data required to be passed to the restore step.
* We store this data in its own section of the backup controller
*
* @param \stdClass $data The course copy data.
* @throws backup_controller_exception
* @deprecated since Moodle 4.1 MDL-74548 - please do not use this method anymore.
* @todo MDL-75025 This method will be deleted in Moodle 4.5
* @see restore_controller::__construct()
* @deprecated since Moodle 4.1 MDL-74548
*/
public function set_copy(\stdClass $data): void {
debugging('The method base_controller::set_copy() is deprecated.
Please use the restore_controller class instead.', DEBUG_DEVELOPER);
// Only allow setting of copy data when controller is in copy mode.
if ($this->mode != backup::MODE_COPY) {
throw new backup_controller_exception('cannot_set_copy_vars_wrong_mode');
}
$this->copy = $data;
#[\core\attribute\deprecated(since: '4.1', mdl: 'MDL-74548', final: true)]
public function set_copy(): void {
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
}
/**
* Get the course copy data.
*
* @return \stdClass
* @deprecated since Moodle 4.1 MDL-74548 - please do not use this method anymore.
* @todo MDL-75026 This method will be deleted in Moodle 4.5
* @see restore_controller::get_copy()
* @deprecated since Moodle 4.1 MDL-74548
*/
public function get_copy(): \stdClass {
debugging('The method base_controller::get_copy() is deprecated.
Please use restore_controller::get_copy() instead.', DEBUG_DEVELOPER);
return $this->copy;
#[\core\attribute\deprecated('restore_controller::get_copy()', since: '4.1', mdl: 'MDL-74548', final: true)]
public function get_copy() {
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
}
}