From: skodak Date: Wed, 16 Sep 2009 19:03:21 +0000 (+0000) Subject: MDL-12886 moved WS related stuff to webservice lib instead of external lib X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=893d7f0f11d9b9341707dd724e2c205a129a27ba;p=moodle.git MDL-12886 moved WS related stuff to webservice lib instead of external lib --- diff --git a/lib/externallib.php b/lib/externallib.php index 2d3da559cd..6b64209c6b 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -105,39 +105,5 @@ class external_api { require_capability('moodle/course:view', $context); } } - - /** - * Returns detailed information about external function - * @param string $functionname name of external function - * @return aray - */ - public static function get_function_info($functionname) { - global $CFG, $DB; - - $function = $DB->get_record('external_functions', array('name'=>$functionname), '*', MUST_EXIST); - - $defpath = get_component_directory($function->component); - if (!file_exists("$defpath/db/services.php")) { - //TODO: maybe better throw invalid parameter exception - return null; - } - - $functions = array(); - include("$defpath/db/services.php"); - - if (empty($functions[$functionname])) { - return null; - } - - $desc = $functions[$functionname]; - if (empty($desc['classpath'])) { - $desc['classpath'] = "$defpath/externallib.php"; - } else { - $desc['classpath'] = "$CFG->dirroot/".$desc['classpath']; - } - $desc['component'] = $function->component; - - return $desc; - } } diff --git a/webservice/lib.php b/webservice/lib.php index bf4d52eb7b..b5ed730127 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -25,6 +25,40 @@ require_once(dirname(dirname(__FILE__)) . '/lib/formslib.php'); +/** + * Returns detailed information about external function + * @param string $functionname name of external function + * @return aray + */ +function ws_get_function_info($functionname) { + global $CFG, $DB; + + $function = $DB->get_record('external_functions', array('name'=>$functionname), '*', MUST_EXIST); + + $defpath = get_component_directory($function->component); + if (!file_exists("$defpath/db/services.php")) { + //TODO: maybe better throw invalid parameter exception + return null; + } + + $functions = array(); + include("$defpath/db/services.php"); + + if (empty($functions[$functionname])) { + return null; + } + + $desc = $functions[$functionname]; + if (empty($desc['classpath'])) { + $desc['classpath'] = "$defpath/externallib.php"; + } else { + $desc['classpath'] = "$CFG->dirroot/".$desc['classpath']; + } + $desc['component'] = $function->component; + + return $desc; +} + /** * web service library */