diff --git a/.upgradenotes/MDL-82342-2024110403441284.yml b/.upgradenotes/MDL-82342-2024110403441284.yml new file mode 100644 index 0000000000000..c3751e38fa3b7 --- /dev/null +++ b/.upgradenotes/MDL-82342-2024110403441284.yml @@ -0,0 +1,8 @@ +issueNumber: MDL-82342 +notes: + core_course: + - message: >- + The core_course_edit_module and core_course_edit_section external + functions are now deprecated. Use core_courseformat_update_course + instead + type: deprecated diff --git a/.upgradenotes/MDL-82342-2024110403545596.yml b/.upgradenotes/MDL-82342-2024110403545596.yml new file mode 100644 index 0000000000000..a58ae1ffcbdca --- /dev/null +++ b/.upgradenotes/MDL-82342-2024110403545596.yml @@ -0,0 +1,8 @@ +issueNumber: MDL-82342 +notes: + core_course: + - message: >- + The core_course_get_module external function is now deprecated. Use + fragment API using component core_courseformat and fragment cmitem + instead + type: deprecated diff --git a/course/externallib.php b/course/externallib.php index c4825433f0ee2..1e040731f6e86 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -3621,10 +3621,20 @@ public static function get_updates_since_returns() { return self::check_updates_returns(); } + /** + * Mark the edit_module as deprecated. + * @todo Remove this method in Moodle 6.0 (MDL-83530). + * @return bool + */ + public static function edit_module_is_deprecated() { + return true; + } + /** * Parameters for function edit_module() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return external_function_parameters */ public static function edit_module_parameters() { @@ -3647,7 +3657,8 @@ public static function edit_module_parameters() { * * Throws exception if operation is not permitted/possible * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @param string $action * @param int $id * @param null|int $sectionreturn @@ -3753,17 +3764,28 @@ public static function edit_module($action, $id, $sectionreturn = null) { /** * Return structure for edit_module() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return \core_external\external_description */ public static function edit_module_returns() { return new external_value(PARAM_RAW, 'html to replace the current module with'); } + /** + * Mark the get_module as deprecated. + * @todo Remove this method in Moodle 6.0 (MDL-83530). + * @return bool + */ + public static function get_module_is_deprecated() { + return true; + } + /** * Parameters for function get_module() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return external_function_parameters */ public static function get_module_parameters() { @@ -3777,7 +3799,8 @@ public static function get_module_parameters() { /** * Returns html for displaying one activity module on course page * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @param int $id * @param null|int $sectionreturn * @return string @@ -3819,17 +3842,28 @@ public static function get_module($id, $sectionreturn = null) { /** * Return structure for get_module() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return \core_external\external_description */ public static function get_module_returns() { return new external_value(PARAM_RAW, 'html to replace the current module with'); } + /** + * Mark the edit_section as deprecated. + * @todo Remove this method in Moodle 6.0 (MDL-83530). + * @return bool + */ + public static function edit_section_is_deprecated() { + return true; + } + /** * Parameters for function edit_section() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return external_function_parameters */ public static function edit_section_parameters() { @@ -3844,7 +3878,8 @@ public static function edit_section_parameters() { /** * Performs one of the edit section actions * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @param string $action * @param int $id section id * @param int $sectionreturn section to return to @@ -3874,7 +3909,8 @@ public static function edit_section($action, $id, $sectionreturn) { /** * Return structure for edit_section() * - * @since Moodle 3.3 + * @deprecated since 5.0 + * @todo Remove this method in Moodle 6.0 (MDL-83530). * @return \core_external\external_description */ public static function edit_section_returns() { diff --git a/lib/db/services.php b/lib/db/services.php index 6c71ca24d7641..79f01a03acf4f 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -570,11 +570,14 @@ 'type' => 'read', 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), ), + // Todo Remove this entry in Moodle 6.0 (MDL-83530). 'core_course_get_module' => array( 'classname' => 'core_course_external', 'methodname' => 'get_module', 'classpath' => 'course/externallib.php', - 'description' => 'Returns html with one activity module on course page', + 'description' => '** DEPRECATED ** Please do not call this function any more (will be removed in Moodle 6.0).' + . 'Returns html with one activity module on course page.' + . 'Use fragment API using component core_courseformat and fragment cmitem instead.', 'type' => 'read', 'ajax' => true, ), @@ -606,19 +609,25 @@ 'ajax' => true, 'capabilities' => 'moodle/course:manageactivities', ], + // Todo Remove this entry in Moodle 6.0 (MDL-83530). 'core_course_edit_module' => array( 'classname' => 'core_course_external', 'methodname' => 'edit_module', 'classpath' => 'course/externallib.php', - 'description' => 'Performs an action on course module (change visibility, duplicate, delete, etc.)', + 'description' => '** DEPRECATED ** Please do not call this function any more (will be removed in Moodle 6.0).' + . ' Performs an action on course module (change visibility, duplicate, delete, etc.)' + . ' Use core_courseformat_update_course instead.', 'type' => 'write', 'ajax' => true, ), + // Todo Remove this entry in Moodle 6.0 (MDL-83530). 'core_course_edit_section' => array( 'classname' => 'core_course_external', 'methodname' => 'edit_section', 'classpath' => 'course/externallib.php', - 'description' => 'Performs an action on course section (change visibility, set marker, delete)', + 'description' => '** DEPRECATED ** Please do not call this function any more (will be removed in Moodle 6.0).' + . 'Performs an action on course section (change visibility, set marker, delete)' + . ' Use core_courseformat_update_course instead.', 'type' => 'write', 'ajax' => true, ),