diff --git a/.upgradenotes/MDL-75025-2024062015422824.yml b/.upgradenotes/MDL-75025-2024062015422824.yml new file mode 100644 index 00000000000..5dffed60c5f --- /dev/null +++ b/.upgradenotes/MDL-75025-2024062015422824.yml @@ -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 diff --git a/.upgradenotes/MDL-75025-2024062015430029.yml b/.upgradenotes/MDL-75025-2024062015430029.yml new file mode 100644 index 00000000000..9736c0f2f2d --- /dev/null +++ b/.upgradenotes/MDL-75025-2024062015430029.yml @@ -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 diff --git a/backup/controller/base_controller.class.php b/backup/controller/base_controller.class.php index a932ca25fbd..f6dd3cef711 100644 --- a/backup/controller/base_controller.class.php +++ b/backup/controller/base_controller.class.php @@ -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__]); } }