Created
October 13, 2015 13:30
-
-
Save danpoltawski/c25c1ebab892622516c8 to your computer and use it in GitHub Desktop.
fix xmlrpc webservices and debugging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/group/externallib.php b/group/externallib.php | |
| index d7a5a07..b530283 100644 | |
| --- a/group/externallib.php | |
| +++ b/group/externallib.php | |
| @@ -1310,7 +1310,7 @@ class core_group_external extends external_api { | |
| return new external_function_parameters( | |
| array( | |
| 'cmid' => new external_value(PARAM_INT, 'course module id'), | |
| - 'userid' => new external_value(PARAM_INT, 'id of user, empty for current user', VALUE_OPTIONAL, 0) | |
| + 'userid' => new external_value(PARAM_INT, 'id of user, empty for current user', VALUE_DEFAULT, 0) | |
| ) | |
| ); | |
| } | |
| diff --git a/notes/externallib.php b/notes/externallib.php | |
| index 944b2fb..b697bf4 100644 | |
| --- a/notes/externallib.php | |
| +++ b/notes/externallib.php | |
| @@ -466,7 +466,7 @@ class core_notes_external extends external_api { | |
| return new external_function_parameters( | |
| array( | |
| 'courseid' => new external_value(PARAM_INT, 'course id, 0 for SITE'), | |
| - 'userid' => new external_value(PARAM_INT, 'user id', VALUE_OPTIONAL), | |
| + 'userid' => new external_value(PARAM_INT, 'user id', VALUE_DEFAULT, 0), | |
| ) | |
| ); | |
| } | |
| diff --git a/webservice/lib.php b/webservice/lib.php | |
| index 879c716..f7e6a28 100644 | |
| --- a/webservice/lib.php | |
| +++ b/webservice/lib.php | |
| @@ -1293,6 +1293,7 @@ class '.$classname.' { | |
| $params = array(); | |
| $params_desc = array(); | |
| foreach ($function->parameters_desc->keys as $name=>$keydesc) { | |
| + $functiondescription = "$function->classname::$function->methodname $name"; | |
| $param = '$'.$name; | |
| $paramanddefault = $param; | |
| //need to generate the default if there is any | |
| @@ -1315,7 +1316,7 @@ class '.$classname.' { | |
| } else if ($keydesc->required == VALUE_OPTIONAL) { | |
| // It does not make sense to declare a parameter VALUE_OPTIONAL. | |
| // VALUE_OPTIONAL is used only for array/object key. | |
| - throw new moodle_exception('erroroptionalparamarray', 'webservice', '', $name); | |
| + throw new moodle_exception('erroroptionalparamarray', 'webservice', '', $functiondescription); | |
| } | |
| } else { //for the moment we do not support default for other structure types | |
| if ($keydesc->required == VALUE_DEFAULT) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment