Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
11c16f5f
Commit
11c16f5f
authored
Apr 14, 2016
by
Damyon Wiese
Committed by
David Monllaó
Apr 14, 2016
Browse files
MDL-53772 externallib: Deprecate external_function_info()
parent
e02e7f5a
Changes
10
Show whitespace changes
Inline
Side-by-side
admin/webservice/documentation.php
View file @
11c16f5f
...
...
@@ -33,7 +33,7 @@ admin_externalpage_setup('webservicedocumentation');
$functions
=
$DB
->
get_records
(
'external_functions'
,
array
(),
'name'
);
$functiondescs
=
array
();
foreach
(
$functions
as
$function
)
{
$functiondescs
[
$function
->
name
]
=
external_function_info
(
$function
);
$functiondescs
[
$function
->
name
]
=
external_api
::
external_function_info
(
$function
);
}
//display the documentation for all documented protocols,
...
...
admin/webservice/forms.php
View file @
11c16f5f
...
...
@@ -196,7 +196,7 @@ class external_service_functions_form extends moodleform {
//we add the descriptions to the functions
foreach
(
$functions
as
$functionid
=>
$functionname
)
{
//retrieve full function information (including the description)
$function
=
external_function_info
(
$functionname
);
$function
=
external_api
::
external_function_info
(
$functionname
);
if
(
empty
(
$function
->
deprecated
))
{
$functions
[
$functionid
]
=
$function
->
name
.
':'
.
$function
->
description
;
}
else
{
...
...
admin/webservice/testclient.php
View file @
11c16f5f
...
...
@@ -49,7 +49,7 @@ admin_externalpage_setup('testclient');
$allfunctions
=
$DB
->
get_records
(
'external_functions'
,
array
(),
'name ASC'
);
$functions
=
array
();
foreach
(
$allfunctions
as
$f
)
{
$finfo
=
external_function_info
(
$f
);
$finfo
=
external_api
::
external_function_info
(
$f
);
if
(
!
empty
(
$finfo
->
testclientpath
)
and
file_exists
(
$CFG
->
dirroot
.
'/'
.
$finfo
->
testclientpath
))
{
//some plugins may want to have own test client forms
include_once
(
$CFG
->
dirroot
.
'/'
.
$finfo
->
testclientpath
);
...
...
@@ -113,7 +113,7 @@ if ($mform->is_cancelled()) {
}
else
if
(
$data
=
$mform
->
get_data
())
{
$functioninfo
=
external_function_info
(
$function
);
$functioninfo
=
external_api
::
external_function_info
(
$function
);
// first load lib of selected protocol
require_once
(
"
$CFG->dirroot
/webservice/
$protocol
/locallib.php"
);
...
...
lib/deprecatedlib.php
View file @
11c16f5f
...
...
@@ -4473,3 +4473,20 @@ function site_scale_used($scaleid, &$courses) {
}
return
$return
;
}
/**
* Returns detailed function information
*
* @deprecated since Moodle 3.1
* @param string|object $function name of external function or record from external_function
* @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
* MUST_EXIST means throw exception if no record or multiple records found
* @return stdClass description or false if not found or exception thrown
* @since Moodle 2.0
*/
function
external_function_info
(
$function
,
$strictness
=
MUST_EXIST
)
{
debugging
(
'external_function_info() is deprecated. Please use external_api::external_function_info() instead.'
,
DEBUG_DEVELOPER
);
return
external_api
::
external_function_info
(
$function
,
$strictness
);
}
lib/externallib.php
View file @
11c16f5f
...
...
@@ -25,19 +25,6 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* Returns detailed function information
*
* @param string|object $function name of external function or record from external_function
* @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
* MUST_EXIST means throw exception if no record or multiple records found
* @return stdClass description or false if not found or exception thrown
* @since Moodle 2.0
*/
function
external_function_info
(
$function
,
$strictness
=
MUST_EXIST
)
{
return
external_api
::
external_function_info
(
$function
,
$strictness
);
}
/**
* Exception indicating user is not allowed to use external function in the current context.
*
...
...
lib/tests/externallib_test.php
View file @
11c16f5f
...
...
@@ -317,7 +317,7 @@ class core_externallib_testcase extends advanced_testcase {
* @dataProvider all_external_info_provider
*/
public
function
test_all_external_info
(
$f
)
{
$desc
=
external_function_info
(
$f
);
$desc
=
external_api
::
external_function_info
(
$f
);
$this
->
assertNotEmpty
(
$desc
->
name
);
$this
->
assertNotEmpty
(
$desc
->
classname
);
$this
->
assertNotEmpty
(
$desc
->
methodname
);
...
...
webservice/lib.php
View file @
11c16f5f
...
...
@@ -1246,7 +1246,7 @@ abstract class webservice_base_server extends webservice_server {
}
// function must exist
$function
=
external_function_info
(
$this
->
functionname
);
$function
=
external_api
::
external_function_info
(
$this
->
functionname
);
if
(
$this
->
restricted_serviceid
)
{
$params
=
array
(
'sid1'
=>
$this
->
restricted_serviceid
,
'sid2'
=>
$this
->
restricted_serviceid
);
...
...
@@ -1475,7 +1475,7 @@ EOD;
* @throws moodle_exception
*/
protected
function
get_virtual_method_code
(
$function
)
{
$function
=
external_function_info
(
$function
);
$function
=
external_api
::
external_function_info
(
$function
);
// Parameters and their defaults for the method signature.
$paramanddefaults
=
array
();
...
...
webservice/renderer.php
View file @
11c16f5f
...
...
@@ -216,7 +216,7 @@ class core_webservice_renderer extends plugin_renderer_base {
$anydeprecated
=
false
;
foreach
(
$functions
as
$function
)
{
$function
=
external_function_info
(
$function
);
$function
=
external_api
::
external_function_info
(
$function
);
if
(
!
empty
(
$function
->
deprecated
))
{
$anydeprecated
=
true
;
...
...
webservice/tests/lib_test.php
View file @
11c16f5f
...
...
@@ -121,7 +121,7 @@ class webservice_test extends advanced_testcase {
// Check the contents of service methods.
foreach
(
$servicemethods
as
$method
)
{
// Get the external function info.
$function
=
external_function_info
(
$method
->
name
);
$function
=
external_api
::
external_function_info
(
$method
->
name
);
// Check input params.
foreach
(
$function
->
parameters_desc
->
keys
as
$name
=>
$keydesc
)
{
...
...
webservice/wsdoc.php
View file @
11c16f5f
...
...
@@ -67,7 +67,7 @@ $functions = $webservice->get_external_functions(array($token->externalserviceid
// get all the function descriptions
$functiondescs
=
array
();
foreach
(
$functions
as
$function
)
{
$functiondescs
[
$function
->
name
]
=
external_function_info
(
$function
);
$functiondescs
[
$function
->
name
]
=
external_api
::
external_function_info
(
$function
);
}
// get activated protocol
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment