diff --git a/admin/webservice/documentation.php b/admin/webservice/documentation.php index 92a4dd87c15..9c727eaf9ac 100644 --- a/admin/webservice/documentation.php +++ b/admin/webservice/documentation.php @@ -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, diff --git a/admin/webservice/forms.php b/admin/webservice/forms.php index 88e543fa64e..08ff31a2c3d 100644 --- a/admin/webservice/forms.php +++ b/admin/webservice/forms.php @@ -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 { diff --git a/admin/webservice/testclient.php b/admin/webservice/testclient.php index d14dbb9d063..444e384fd97 100644 --- a/admin/webservice/testclient.php +++ b/admin/webservice/testclient.php @@ -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"); diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 6affc75f3d1..8964b9b49a2 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -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); +} + diff --git a/lib/externallib.php b/lib/externallib.php index 48a33324e97..7c0e838e2cb 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -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. * diff --git a/lib/tests/externallib_test.php b/lib/tests/externallib_test.php index df37d0a40bc..c018617b2c6 100644 --- a/lib/tests/externallib_test.php +++ b/lib/tests/externallib_test.php @@ -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); diff --git a/webservice/lib.php b/webservice/lib.php index 2fa826deca1..84bcc794ee4 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -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(); diff --git a/webservice/renderer.php b/webservice/renderer.php index cc4b685ba40..4dc971d06ed 100644 --- a/webservice/renderer.php +++ b/webservice/renderer.php @@ -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; diff --git a/webservice/tests/lib_test.php b/webservice/tests/lib_test.php index 6629899cc72..5fd86802fee 100644 --- a/webservice/tests/lib_test.php +++ b/webservice/tests/lib_test.php @@ -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) { diff --git a/webservice/wsdoc.php b/webservice/wsdoc.php index 01b71c034c9..f5bb7ab3cb5 100644 --- a/webservice/wsdoc.php +++ b/webservice/wsdoc.php @@ -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