mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
Merge branch 'MDL-49333-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
88019507b7
2 changed files with 42 additions and 1 deletions
|
@ -160,6 +160,23 @@ class core_webservice_external extends external_api {
|
||||||
// Mobile CSS theme and alternative login url.
|
// Mobile CSS theme and alternative login url.
|
||||||
$siteinfo['mobilecssurl'] = $CFG->mobilecssurl;
|
$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;
|
return $siteinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +217,18 @@ class core_webservice_external extends external_api {
|
||||||
VALUE_OPTIONAL),
|
VALUE_OPTIONAL),
|
||||||
'release' => new external_value(PARAM_TEXT, 'Moodle release number', VALUE_OPTIONAL),
|
'release' => new external_value(PARAM_TEXT, 'Moodle release number', VALUE_OPTIONAL),
|
||||||
'version' => new external_value(PARAM_TEXT, 'Moodle version 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($function['version'], $siteinfo['version']);
|
||||||
$this->assertEquals(1, $siteinfo['downloadfiles']);
|
$this->assertEquals(1, $siteinfo['downloadfiles']);
|
||||||
$this->assertEquals(1, $siteinfo['uploadfiles']);
|
$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…
Add table
Add a link
Reference in a new issue