diff --git a/admin/webservice/forms.php b/admin/webservice/forms.php index 41c15c25e0d13..9465bf416eae0 100644 --- a/admin/webservice/forms.php +++ b/admin/webservice/forms.php @@ -190,7 +190,12 @@ function definition() { foreach ($functions as $functionid => $functionname) { //retrieve full function information (including the description) $function = external_function_info($functionname); - $functions[$functionid] = $function->name . ':' . $function->description; + if (empty($function->deprecated)) { + $functions[$functionid] = $function->name . ':' . $function->description; + } else { + // Exclude the deprecated ones. + unset($functions[$functionid]); + } } $mform->addElement('searchableselector', 'fids', get_string('name'), diff --git a/course/externallib.php b/course/externallib.php index c5f5b34811807..bda5b9a7faaa8 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -1982,6 +1982,15 @@ public static function get_courses_returns() { return core_course_external::get_courses_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_courses_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -2019,4 +2028,12 @@ public static function create_courses_returns() { return core_course_external::create_courses_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function create_courses_is_deprecated() { + return true; + } } diff --git a/enrol/externallib.php b/enrol/externallib.php index 619cea0d9c77c..711a1e07b8de2 100644 --- a/enrol/externallib.php +++ b/enrol/externallib.php @@ -922,6 +922,15 @@ public static function get_enrolled_users_returns() { ); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_enrolled_users_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -960,6 +969,14 @@ public static function get_users_courses_returns() { return core_enrol_external::get_users_courses_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_users_courses_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -997,6 +1014,14 @@ public static function role_assign_returns() { return core_role_external::assign_roles_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function role_assign_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1033,4 +1058,13 @@ public static function role_unassign($unassignments) { public static function role_unassign_returns() { return core_role_external::unassign_roles_returns(); } + + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function role_unassign_is_deprecated() { + return true; + } } diff --git a/enrol/manual/db/services.php b/enrol/manual/db/services.php index 7b080463ea991..87e4e30561182 100644 --- a/enrol/manual/db/services.php +++ b/enrol/manual/db/services.php @@ -27,8 +27,8 @@ // === enrol related functions === 'moodle_enrol_manual_enrol_users' => array( - 'classname' => 'enrol_manual_external', - 'methodname' => 'enrol_users', + 'classname' => 'moodle_enrol_manual_external', + 'methodname' => 'manual_enrol_users', 'classpath' => 'enrol/manual/externallib.php', 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as enrol_manual_enrol_users()', 'capabilities'=> 'enrol/manual:enrol', diff --git a/enrol/manual/externallib.php b/enrol/manual/externallib.php index 7cec2827af667..d24cc1cd65076 100644 --- a/enrol/manual/externallib.php +++ b/enrol/manual/externallib.php @@ -207,4 +207,12 @@ public static function manual_enrol_users_returns() { return enrol_manual_external::enrol_users_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function manual_enrol_users_is_deprecated() { + return true; + } } diff --git a/files/externallib.php b/files/externallib.php index fdf63c548b190..31442c064eb07 100644 --- a/files/externallib.php +++ b/files/externallib.php @@ -404,13 +404,18 @@ public static function get_files_parameters() { * @param int $itemid * @param string $filepath * @param string $filename + * @param int $modified timestamp to return files changed after this time. + * @param string $contextlevel The context level for the file location. + * @param int $instanceid The instance id for where the file is located. * @return array * @since Moodle 2.0 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more. * @see core_files_external::get_files() */ - public static function get_files($contextid, $component, $filearea, $itemid, $filepath, $filename) { - return core_files_external::get_files($contextid, $component, $filearea, $itemid, $filepath, $filename); + public static function get_files($contextid, $component, $filearea, $itemid, $filepath, $filename, $modified = null, + $contextlevel = null, $instanceid = null) { + return core_files_external::get_files($contextid, $component, $filearea, $itemid, $filepath, $filename, + $modified, $contextlevel, $instanceid); } /** @@ -425,6 +430,15 @@ public static function get_files_returns() { return core_files_external::get_files_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_files_is_deprecated() { + return true; + } + /** * Returns description of upload parameters * @@ -447,13 +461,16 @@ public static function upload_parameters() { * @param string $filepath * @param string $filename * @param string $filecontent + * @param string $contextlevel Context level (block, course, coursecat, system, user or module) + * @param int $instanceid Instance id of the item associated with the context level * @return array * @since Moodle 2.0 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more. * @see core_files_external::upload() */ - public static function upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent) { - return core_files_external::upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent); + public static function upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent, $contextlevel, $instanceid) { + return core_files_external::upload($contextid, $component, $filearea, $itemid, $filepath, $filename, + $filecontent, $contextlevel, $instanceid); } /** @@ -467,4 +484,14 @@ public static function upload($contextid, $component, $filearea, $itemid, $filep public static function upload_returns() { return core_files_external::upload_returns(); } + + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function upload_is_deprecated() { + return true; + } + } diff --git a/grade/externallib.php b/grade/externallib.php index ef5e6988f7ad4..98deb9bfa601b 100644 --- a/grade/externallib.php +++ b/grade/externallib.php @@ -41,11 +41,19 @@ public static function get_definitions_parameters() { } public static function get_definitions($cmids, $areaname, $activeonly = false) { - return core_grading_external::get_definitions($cmids, $areaname, $activeonly = false); + return core_grading_external::get_definitions($cmids, $areaname, $activeonly); } public static function get_definitions_returns() { return core_grading_external::get_definitions_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_definitions_is_deprecated() { + return true; + } } diff --git a/group/externallib.php b/group/externallib.php index 7836758abe298..f02b748c1fd2f 100644 --- a/group/externallib.php +++ b/group/externallib.php @@ -1205,6 +1205,15 @@ public static function create_groups_returns() { return core_group_external::create_groups_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function create_groups_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1242,6 +1251,15 @@ public static function get_groups_returns() { return core_group_external::get_groups_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_groups_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1279,6 +1297,15 @@ public static function get_course_groups_returns() { return core_group_external::get_course_groups_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_course_groups_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1288,7 +1315,7 @@ public static function get_course_groups_returns() { * @see core_group_external::delete_group_members_parameters() */ public static function delete_groups_parameters() { - return core_group_external::delete_group_members_parameters(); + return core_group_external::delete_groups_parameters(); } /** @@ -1312,9 +1339,17 @@ public static function delete_groups($groupids) { * @see core_group_external::delete_group_members_returns() */ public static function delete_groups_returns() { - return core_group_external::delete_group_members_returns(); + return core_group_external::delete_groups_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function delete_groups_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1353,6 +1388,14 @@ public static function get_groupmembers_returns() { return core_group_external::get_group_members_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_groupmembers_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1390,6 +1433,14 @@ public static function add_groupmembers_returns() { return core_group_external::add_group_members_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function add_groupmembers_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1427,4 +1478,13 @@ public static function delete_groupmembers_returns() { return core_group_external::delete_group_members_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function delete_groupmembers_is_deprecated() { + return true; + } + } diff --git a/lib/db/services.php b/lib/db/services.php index 84bf5f02955f3..2130148bf2422 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -122,10 +122,10 @@ // === group related functions === 'moodle_group_create_groups' => array( - 'classname' => 'core_group_external', + 'classname' => 'moodle_group_external', 'methodname' => 'create_groups', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_create_groups(). ', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_create_groups(). ', 'type' => 'write', 'capabilities'=> 'moodle/course:managegroups', ), @@ -140,10 +140,10 @@ ), 'moodle_group_get_groups' => array( - 'classname' => 'core_group_external', + 'classname' => 'moodle_group_external', 'methodname' => 'get_groups', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_groups()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_groups()', 'type' => 'read', 'capabilities'=> 'moodle/course:managegroups', ), @@ -158,10 +158,10 @@ ), 'moodle_group_get_course_groups' => array( - 'classname' => 'core_group_external', + 'classname' => 'moodle_group_external', 'methodname' => 'get_course_groups', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_course_groups()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_course_groups()', 'type' => 'read', 'capabilities'=> 'moodle/course:managegroups', ), @@ -176,10 +176,10 @@ ), 'moodle_group_delete_groups' => array( - 'classname' => 'core_group_external', + 'classname' => 'moodle_group_external', 'methodname' => 'delete_groups', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_groups()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_groups()', 'type' => 'delete', 'capabilities'=> 'moodle/course:managegroups', ), @@ -194,10 +194,10 @@ ), 'moodle_group_get_groupmembers' => array( - 'classname' => 'core_group_external', - 'methodname' => 'get_group_members', + 'classname' => 'moodle_group_external', + 'methodname' => 'get_groupmembers', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_group_members()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_group_members()', 'type' => 'read', 'capabilities'=> 'moodle/course:managegroups', ), @@ -212,10 +212,10 @@ ), 'moodle_group_add_groupmembers' => array( - 'classname' => 'core_group_external', - 'methodname' => 'add_group_members', + 'classname' => 'moodle_group_external', + 'methodname' => 'add_groupmembers', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_add_group_members()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_add_group_members()', 'type' => 'write', 'capabilities'=> 'moodle/course:managegroups', ), @@ -230,10 +230,10 @@ ), 'moodle_group_delete_groupmembers' => array( - 'classname' => 'core_group_external', - 'methodname' => 'delete_group_members', + 'classname' => 'moodle_group_external', + 'methodname' => 'delete_groupmembers', 'classpath' => 'group/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_group_members()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_group_members()', 'type' => 'delete', 'capabilities'=> 'moodle/course:managegroups', ), @@ -306,9 +306,9 @@ // === file related functions === 'moodle_file_get_files' => array( - 'classname' => 'core_files_external', + 'classname' => 'moodle_file_external', 'methodname' => 'get_files', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_get_files()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_get_files()', 'type' => 'read', 'classpath' => 'files/externallib.php', ), @@ -322,9 +322,9 @@ ), 'moodle_file_upload' => array( - 'classname' => 'core_files_external', + 'classname' => 'moodle_file_external', 'methodname' => 'upload', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_upload()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_upload()', 'type' => 'write', 'classpath' => 'files/externallib.php', ), @@ -340,10 +340,10 @@ // === user related functions === 'moodle_user_create_users' => array( - 'classname' => 'core_user_external', + 'classname' => 'moodle_user_external', 'methodname' => 'create_users', 'classpath' => 'user/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_create_users()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_create_users()', 'type' => 'write', 'capabilities'=> 'moodle/user:create', ), @@ -367,10 +367,10 @@ ), 'moodle_user_get_users_by_id' => array( - 'classname' => 'core_user_external', + 'classname' => 'moodle_user_external', 'methodname' => 'get_users_by_id', 'classpath' => 'user/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_users_by_id()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. Use core_user_get_users_by_field service instead', 'type' => 'read', 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update', ), @@ -394,19 +394,19 @@ ), 'moodle_user_get_users_by_courseid' => array( - 'classname' => 'core_enrol_external', - 'methodname' => 'get_enrolled_users', - 'classpath' => 'enrol/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_enrolled_users()', + 'classname' => 'moodle_user_external', + 'methodname' => 'get_users_by_courseid', + 'classpath' => 'user/externallib.php', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_enrolled_users()', 'type' => 'read', 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', ), 'moodle_user_get_course_participants_by_id' => array( - 'classname' => 'core_user_external', - 'methodname' => 'get_course_user_profiles', + 'classname' => 'moodle_user_external', + 'methodname' => 'get_course_participants_by_id', 'classpath' => 'user/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_course_user_profiles()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_get_course_user_profiles()', 'type' => 'read', 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', ), @@ -421,10 +421,10 @@ ), 'moodle_user_delete_users' => array( - 'classname' => 'core_user_external', + 'classname' => 'moodle_user_external', 'methodname' => 'delete_users', 'classpath' => 'user/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_delete_users()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_delete_users()', 'type' => 'write', 'capabilities'=> 'moodle/user:delete', ), @@ -439,10 +439,10 @@ ), 'moodle_user_update_users' => array( - 'classname' => 'core_user_external', + 'classname' => 'moodle_user_external', 'methodname' => 'update_users', 'classpath' => 'user/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_update_users()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_update_users()', 'type' => 'write', 'capabilities'=> 'moodle/user:update', ), @@ -496,10 +496,10 @@ ), 'moodle_enrol_get_users_courses' => array( - 'classname' => 'core_enrol_external', + 'classname' => 'moodle_enrol_external', 'methodname' => 'get_users_courses', 'classpath' => 'enrol/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_users_courses()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_users_courses()', 'type' => 'read', 'capabilities'=> 'moodle/course:viewparticipants', ), @@ -524,10 +524,10 @@ // === Role related functions === 'moodle_role_assign' => array( - 'classname' => 'core_role_external', - 'methodname' => 'assign_roles', + 'classname' => 'moodle_enrol_external', + 'methodname' => 'role_assign', 'classpath' => 'enrol/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_assign_role()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()', 'type' => 'write', 'capabilities'=> 'moodle/role:assign', ), @@ -542,10 +542,10 @@ ), 'moodle_role_unassign' => array( - 'classname' => 'core_role_external', - 'methodname' => 'unassign_roles', + 'classname' => 'moodle_enrol_external', + 'methodname' => 'role_unassign', 'classpath' => 'enrol/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_unassign_role()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()', 'type' => 'write', 'capabilities'=> 'moodle/role:assign', ), @@ -571,10 +571,10 @@ ), 'moodle_course_get_courses' => array( - 'classname' => 'core_course_external', + 'classname' => 'moodle_course_external', 'methodname' => 'get_courses', 'classpath' => 'course/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_get_courses()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()', 'type' => 'read', 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses', ), @@ -589,10 +589,10 @@ ), 'moodle_course_create_courses' => array( - 'classname' => 'core_course_external', + 'classname' => 'moodle_course_external', 'methodname' => 'create_courses', 'classpath' => 'course/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_create_courses()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()', 'type' => 'write', 'capabilities'=> 'moodle/course:create,moodle/course:visibility', ), @@ -692,10 +692,10 @@ // === message related functions === 'moodle_message_send_instantmessages' => array( - 'classname' => 'core_message_external', - 'methodname' => 'send_instant_messages', + 'classname' => 'moodle_message_external', + 'methodname' => 'send_instantmessages', 'classpath' => 'message/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_message_send_instant_messages()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_message_send_instant_messages()', 'type' => 'write', 'capabilities'=> 'moodle/site:sendmessage', ), @@ -784,10 +784,10 @@ // === notes related functions === 'moodle_notes_create_notes' => array( - 'classname' => 'core_notes_external', + 'classname' => 'moodle_notes_external', 'methodname' => 'create_notes', 'classpath' => 'notes/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_notes_create_notes()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()', 'type' => 'write', 'capabilities'=> 'moodle/notes:manage', ), @@ -862,10 +862,10 @@ // === webservice related functions === 'moodle_webservice_get_siteinfo' => array( - 'classname' => 'core_webservice_external', - 'methodname' => 'get_site_info', + 'classname' => 'moodle_webservice_external', + 'methodname' => 'get_siteinfo', 'classpath' => 'webservice/externallib.php', - 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_webservice_get_site_info()', + 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_webservice_get_site_info()', 'type' => 'read', ), diff --git a/lib/externallib.php b/lib/externallib.php index 56144efcb3a89..a9ed4bf480562 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -58,6 +58,7 @@ function external_function_info($function, $strictness=MUST_EXIST) { $function->parameters_method = $function->methodname.'_parameters'; $function->returns_method = $function->methodname.'_returns'; + $function->deprecated_method = $function->methodname.'_is_deprecated'; // make sure the implementaion class is ok if (!method_exists($function->classname, $function->methodname)) { @@ -69,6 +70,11 @@ function external_function_info($function, $strictness=MUST_EXIST) { if (!method_exists($function->classname, $function->returns_method)) { throw new coding_exception('Missing returned values description'); } + if (method_exists($function->classname, $function->deprecated_method)) { + if (call_user_func(array($function->classname, $function->deprecated_method)) === true) { + $function->deprecated = true; + } + } // fetch the parameters description $function->parameters_desc = call_user_func(array($function->classname, $function->parameters_method)); diff --git a/message/externallib.php b/message/externallib.php index 86a2321de932a..043c419309fb1 100644 --- a/message/externallib.php +++ b/message/externallib.php @@ -978,4 +978,12 @@ public static function send_instantmessages_returns() { return core_message_external::send_instant_messages_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function send_instantmessages_is_deprecated() { + return true; + } } diff --git a/notes/externallib.php b/notes/externallib.php index f8aa20d982c9c..d06d98270e7c2 100644 --- a/notes/externallib.php +++ b/notes/externallib.php @@ -516,4 +516,13 @@ public static function create_notes_returns() { return core_notes_external::create_notes_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function create_notes_is_deprecated() { + return true; + } + } diff --git a/user/externallib.php b/user/externallib.php index 7b298e81877f5..9a5b37837c67b 100644 --- a/user/externallib.php +++ b/user/externallib.php @@ -1201,6 +1201,14 @@ public static function create_users_returns() { return core_user_external::create_users_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function create_users_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1239,6 +1247,14 @@ public static function delete_users_returns() { return core_user_external::delete_users_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function delete_users_is_deprecated() { + return true; + } /** * Returns description of method parameters @@ -1277,6 +1293,15 @@ public static function update_users_returns() { return core_user_external::update_users_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function update_users_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1316,6 +1341,16 @@ public static function get_users_by_id($userids) { public static function get_users_by_id_returns() { return core_user_external::get_users_by_id_returns(); } + + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_users_by_id_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1353,6 +1388,15 @@ public static function get_course_participants_by_id_returns() { return core_user_external::get_course_user_profiles_returns(); } + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_course_participants_by_id_is_deprecated() { + return true; + } + /** * Returns description of method parameters * @@ -1380,7 +1424,7 @@ public static function get_users_by_courseid_parameters() { * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more. * @see core_enrol_external::get_enrolled_users() */ - public static function get_users_by_courseid($courseid, $options) { + public static function get_users_by_courseid($courseid, $options = array()) { global $CFG; require_once($CFG->dirroot . '/enrol/externallib.php'); return core_enrol_external::get_enrolled_users($courseid, $options); @@ -1398,4 +1442,15 @@ public static function get_users_by_courseid_returns() { require_once($CFG->dirroot . '/enrol/externallib.php'); return core_enrol_external::get_enrolled_users_returns(); } + + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_users_by_courseid_is_deprecated() { + return true; + } + + } diff --git a/version.php b/version.php index cf8131e7a8662..48834207d422f 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2015020500.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2015020600.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. diff --git a/webservice/externallib.php b/webservice/externallib.php index b91243b1e3951..26e81a5c66b19 100644 --- a/webservice/externallib.php +++ b/webservice/externallib.php @@ -257,4 +257,13 @@ public function get_siteinfo($serviceshortnames = array()) { public static function get_siteinfo_returns() { return core_webservice_external::get_site_info_returns(); } + + /** + * Marking the method as deprecated. + * + * @return bool + */ + public static function get_siteinfo_is_deprecated() { + return true; + } } diff --git a/webservice/renderer.php b/webservice/renderer.php index 3c6d7717502e3..624109cbffa9f 100644 --- a/webservice/renderer.php +++ b/webservice/renderer.php @@ -214,8 +214,13 @@ public function admin_service_function_list($functions, $service) { $table->align[] = 'center'; } + $anydeprecated = false; foreach ($functions as $function) { $function = external_function_info($function); + + if (!empty($function->deprecated)) { + $anydeprecated = true; + } $requiredcaps = html_writer::tag('div', empty($function->capabilities) ? '' : $function->capabilities, array('class' => 'functiondesc')); @@ -244,6 +249,10 @@ public function admin_service_function_list($functions, $service) { //display add function operation (except for build-in service) if (empty($service->component)) { + + if (!empty($anydeprecated)) { + debugging('This service uses deprecated functions, replace them by the proposed ones and update your client/s.', DEBUG_DEVELOPER); + } $addurl = new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php', array('sesskey' => sesskey(), 'id' => $service->id, 'action' => 'add')); $html .= html_writer::tag('a', get_string('addfunctions', 'webservice'), array('href' => $addurl)); diff --git a/webservice/upgrade.txt b/webservice/upgrade.txt index 32af7f4d84ef3..a7646c2e6dd90 100644 --- a/webservice/upgrade.txt +++ b/webservice/upgrade.txt @@ -3,6 +3,46 @@ information provided here is intended especially for developers. This information is intended for authors of webservices, not people writing webservice clients. +=== 2.9 === + +* The deprecated functions can not be added to services anymore and + a debugging message for developers is triggered when viewing an existing + services using them. It is recommended to replace calls to the deprecated + functions for calls to the proposed replacements. If you are using a moodle + mobile app fork, it is recommended to update your customisations on top of + the latest moodle mobile app version. + + The web services functions that will be finally deprecated in the next + moodle version are: + - moodle_course_create_courses + - moodle_course_get_courses + - moodle_enrol_get_enrolled_users + - moodle_enrol_get_users_courses + - moodle_enrol_manual_enrol_users + - moodle_file_get_files + - moodle_file_upload + - moodle_group_add_groupmembers + - moodle_group_create_groups + - moodle_group_delete_groupmembers + - moodle_group_delete_groups + - moodle_group_get_course_groups + - moodle_group_get_groupmembers + - moodle_group_get_groups + - moodle_message_send_instantmessages + - moodle_notes_create_notes + - moodle_role_assign + - moodle_role_unassign + - moodle_user_create_users + - moodle_user_delete_users + - moodle_user_get_course_participants_by_id + - moodle_user_get_users_by_courseid + - moodle_user_get_users_by_id + - moodle_user_update_users + - core_grade_get_definitions + - core_user_get_users_by_id + - moodle_webservice_get_siteinfo + + === 2.7 === * All webservice server.php and simpleserver.php scripts must define('WS_SERVER', true)