mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
Merge branch 'MDL-49333-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
88019507b7
@ -160,6 +160,23 @@ class core_webservice_external extends external_api {
|
||||
// Mobile CSS theme and alternative login url.
|
||||
$siteinfo['mobilecssurl'] = $CFG->mobilecssurl;
|
||||
|
||||
// Retrieve some advanced features. Only enable/disable ones (bool).
|
||||
$advancedfeatures = array("usecomments", "usetags", "enablenotes", "messaging", "enableblogs",
|
||||
"enablecompletion", "enablebadges");
|
||||
foreach ($advancedfeatures as $feature) {
|
||||
if (isset($CFG->{$feature})) {
|
||||
$siteinfo['advancedfeatures'][] = array(
|
||||
'name' => $feature,
|
||||
'value' => (int) $CFG->{$feature}
|
||||
);
|
||||
}
|
||||
}
|
||||
// Special case mnet_dispatcher_mode.
|
||||
$siteinfo['advancedfeatures'][] = array(
|
||||
'name' => 'mnet_dispatcher_mode',
|
||||
'value' => ($CFG->mnet_dispatcher_mode == 'strict') ? 1 : 0
|
||||
);
|
||||
|
||||
return $siteinfo;
|
||||
}
|
||||
|
||||
@ -200,7 +217,18 @@ class core_webservice_external extends external_api {
|
||||
VALUE_OPTIONAL),
|
||||
'release' => new external_value(PARAM_TEXT, 'Moodle release number', VALUE_OPTIONAL),
|
||||
'version' => new external_value(PARAM_TEXT, 'Moodle version number', VALUE_OPTIONAL),
|
||||
'mobilecssurl' => new external_value(PARAM_URL, 'Mobile custom CSS theme', VALUE_OPTIONAL)
|
||||
'mobilecssurl' => new external_value(PARAM_URL, 'Mobile custom CSS theme', VALUE_OPTIONAL),
|
||||
'advancedfeatures' => new external_multiple_structure(
|
||||
new external_single_structure(
|
||||
array(
|
||||
'name' => new external_value(PARAM_ALPHANUMEXT, 'feature name'),
|
||||
'value' => new external_value(PARAM_INT, 'feature value. Usually 1 means enabled.')
|
||||
),
|
||||
'Advanced features availability'
|
||||
),
|
||||
'Advanced features availability',
|
||||
VALUE_OPTIONAL
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -100,6 +100,19 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
|
||||
$this->assertEquals($function['version'], $siteinfo['version']);
|
||||
$this->assertEquals(1, $siteinfo['downloadfiles']);
|
||||
$this->assertEquals(1, $siteinfo['uploadfiles']);
|
||||
|
||||
foreach ($siteinfo['advancedfeatures'] as $feature) {
|
||||
if ($feature['name'] == 'mnet_dispatcher_mode') {
|
||||
if ($CFG->mnet_dispatcher_mode == 'off') {
|
||||
$this->assertEquals(0, $feature['value']);
|
||||
} else {
|
||||
$this->assertEquals(1, $feature['value']);
|
||||
}
|
||||
} else {
|
||||
$this->assertEquals($CFG->{$feature['name']}, $feature['value']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user