MDL-56160 ws: Return site course ID in get_site_info

This commit is contained in:
Dani Palou 2016-09-28 12:26:32 +02:00
parent 26162efe4a
commit 43695b6a72
3 changed files with 6 additions and 2 deletions

View File

@ -92,7 +92,8 @@ class core_webservice_external extends external_api {
'fullname' => fullname($USER),
'lang' => current_language(),
'userid' => $USER->id,
'userpictureurl' => $profileimageurl->out(false)
'userpictureurl' => $profileimageurl->out(false),
'siteid' => SITEID
);
// Retrieve the service and functions from the web service linked to the token
@ -257,7 +258,8 @@ class core_webservice_external extends external_api {
VALUE_OPTIONAL),
'userhomepage' => new external_value(PARAM_INT,
'the default home page for the user: 0 for the site home, 1 for dashboard',
VALUE_OPTIONAL)
VALUE_OPTIONAL),
'siteid' => new external_value(PARAM_INT, 'Site course ID', VALUE_OPTIONAL)
)
);
}

View File

@ -95,6 +95,7 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this->assertEquals('Doe', $siteinfo['lastname']);
$this->assertEquals(current_language(), $siteinfo['lang']);
$this->assertEquals($USER->id, $siteinfo['userid']);
$this->assertEquals(SITEID, $siteinfo['siteid']);
$this->assertEquals(true, $siteinfo['downloadfiles']);
$this->assertEquals($CFG->release, $siteinfo['release']);
$this->assertEquals($CFG->version, $siteinfo['version']);

View File

@ -11,6 +11,7 @@ This information is intended for authors of webservices, not people writing webs
* external_format_text() function: component, filearea and itemid are now optional parameters.
In some contexts those parameteres are not necessary because is not required to do a file rewrite via
file_rewrite_pluginfile_urls.
* External function get_site_info now returns the site course ID. This new field is marked as VALUE_OPTIONAL for backwards compatibility.
=== 3.1 ===