MDL-43535 webservices: Marking functions as deprecated
authorDavid Monllao <davidm@moodle.com>
Fri, 23 Jan 2015 02:24:13 +0000 (10:24 +0800)
committerDavid Monllao <davidm@moodle.com>
Sun, 8 Feb 2015 21:42:22 +0000 (05:42 +0800)
Also:
- We don't allow users to add deprecated functions to WS
- We show a debugging message when deprecated functions
  are already being used in web services.

17 files changed:
admin/webservice/forms.php
course/externallib.php
enrol/externallib.php
enrol/manual/db/services.php
enrol/manual/externallib.php
files/externallib.php
grade/externallib.php
group/externallib.php
lib/db/services.php
lib/externallib.php
message/externallib.php
notes/externallib.php
user/externallib.php
version.php
webservice/externallib.php
webservice/renderer.php
webservice/upgrade.txt

index 41c15c2..9465bf4 100644 (file)
@@ -190,7 +190,12 @@ class external_service_functions_form extends moodleform {
         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'),
index c5f5b34..bda5b9a 100644 (file)
@@ -1982,6 +1982,15 @@ class moodle_course_external extends external_api {
         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 @@ class moodle_course_external extends external_api {
         return core_course_external::create_courses_returns();
     }
 
+    /**
+     * Marking the method as deprecated.
+     *
+     * @return bool
+     */
+    public static function create_courses_is_deprecated() {
+        return true;
+    }
 }
index 619cea0..711a1e0 100644 (file)
@@ -922,6 +922,15 @@ class moodle_enrol_external extends external_api {
         );
     }
 
+    /**
+     * 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 @@ class moodle_enrol_external extends external_api {
         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 @@ class moodle_enrol_external extends external_api {
         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 @@ class moodle_enrol_external extends external_api {
     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;
+    }
 }
index 7b08046..87e4e30 100644 (file)
@@ -27,8 +27,8 @@ $functions = array(
 
     // === 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',
index 7cec282..d24cc1c 100644 (file)
@@ -207,4 +207,12 @@ class moodle_enrol_manual_external extends external_api {
         return enrol_manual_external::enrol_users_returns();
     }
 
+    /**
+     * Marking the method as deprecated.
+     *
+     * @return bool
+     */
+    public static function manual_enrol_users_is_deprecated() {
+        return true;
+    }
 }
index fdf63c5..31442c0 100644 (file)
@@ -404,13 +404,18 @@ class moodle_file_external extends external_api {
      * @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 @@ class moodle_file_external extends external_api {
         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 @@ class moodle_file_external extends external_api {
      * @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 @@ class moodle_file_external extends external_api {
     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;
+    }
+
 }
index ef5e698..98deb9b 100644 (file)
@@ -41,11 +41,19 @@ class core_grade_external extends external_api {
     }
 
     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;
+    }
 }
index 7836758..f02b748 100644 (file)
@@ -1205,6 +1205,15 @@ class moodle_group_external extends external_api {
         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 @@ class moodle_group_external extends external_api {
         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 @@ class moodle_group_external extends external_api {
         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 @@ class moodle_group_external extends external_api {
      * @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 @@ class moodle_group_external extends external_api {
      * @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 @@ class moodle_group_external extends external_api {
         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 @@ class moodle_group_external extends external_api {
         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 @@ class moodle_group_external extends external_api {
         return core_group_external::delete_group_members_returns();
     }
 
+    /**
+     * Marking the method as deprecated.
+     *
+     * @return bool
+     */
+    public static function delete_groupmembers_is_deprecated() {
+        return true;
+    }
+
 }
index 84bf5f0..2130148 100644 (file)
@@ -122,10 +122,10 @@ $functions = array(
     // === 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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     // === 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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     // === 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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     // === 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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     ),
 
     '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 @@ $functions = array(
     // === 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 @@ $functions = array(
     // === 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 @@ $functions = array(
     // === 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',
     ),
 
index 56144ef..a9ed4bf 100644 (file)
@@ -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));
index 86a2321..043c419 100644 (file)
@@ -978,4 +978,12 @@ class moodle_message_external extends external_api {
         return core_message_external::send_instant_messages_returns();
     }
 
+    /**
+     * Marking the method as deprecated.
+     *
+     * @return bool
+     */
+    public static function send_instantmessages_is_deprecated() {
+        return true;
+    }
 }
index f8aa20d..d06d982 100644 (file)
@@ -516,4 +516,13 @@ class moodle_notes_external extends external_api {
         return core_notes_external::create_notes_returns();
     }
 
+    /**
+     * Marking the method as deprecated.
+     *
+     * @return bool
+     */
+    public static function create_notes_is_deprecated() {
+        return true;
+    }
+
 }
index 7b298e8..9a5b378 100644 (file)
@@ -1201,6 +1201,14 @@ class moodle_user_external extends external_api {
         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 @@ class moodle_user_external extends external_api {
         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 @@ class moodle_user_external extends external_api {
         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 @@ class moodle_user_external extends external_api {
     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 @@ class moodle_user_external extends external_api {
         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 @@ class moodle_user_external extends external_api {
      * @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 @@ class moodle_user_external extends external_api {
         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;
+    }
+
+
 }
index cf8131e..4883420 100644 (file)
@@ -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.
 
index b91243b..26e81a5 100644 (file)
@@ -257,4 +257,13 @@ class moodle_webservice_external extends external_api {
     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;
+    }
 }
index 3c6d771..624109c 100644 (file)
@@ -214,8 +214,13 @@ class core_webservice_renderer extends plugin_renderer_base {
                 $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 @@ class core_webservice_renderer extends plugin_renderer_base {
 
         //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));
index 32af7f4..a7646c2 100644 (file)
@@ -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)