Skip to content

Commit

Permalink
MDL-82342 core_course: deprecate old course edit webservices
Browse files Browse the repository at this point in the history
Both core_course_edit_section and core_course_edit_module are not needed
anymore. All course edit actions are now executed as state actions from
core_courseformat_update_course. Also, the core_course_get_module is
fully replaced by the core_crouseformat cmitem fragment (including also
any possible JS module).
  • Loading branch information
ferranrecio committed Nov 4, 2024
1 parent 3a1f137 commit cbdb8f6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .upgradenotes/MDL-82342-2024110403441284.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .upgradenotes/MDL-82342-2024110403545596.yml
Original file line number Diff line number Diff line change
@@ -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
54 changes: 45 additions & 9 deletions course/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
12 changes: 9 additions & 3 deletions lib/db/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@
'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,
),
Expand Down Expand Up @@ -610,15 +612,19 @@
'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,
),
'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,
),
Expand Down

0 comments on commit cbdb8f6

Please sign in to comment.