mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-51478 webservice: Enable the Mobile service by default
This commit is contained in:
parent
fd57d685c7
commit
6b6deb8e74
@ -277,11 +277,18 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('webservicesettings', new lang_string('webservices', 'webservice')));
|
||||
// Mobile
|
||||
$temp = new admin_settingpage('mobile', new lang_string('mobile','admin'), 'moodle/site:config', false);
|
||||
$enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
|
||||
$enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation'));
|
||||
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
|
||||
new lang_string('enablemobilewebservice', 'admin'),
|
||||
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0));
|
||||
|
||||
// We should wait to the installation to finish since we depend on some configuration values that are set once
|
||||
// the admin user profile is configured.
|
||||
if (!during_initial_install()) {
|
||||
$enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
|
||||
$enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation'));
|
||||
$default = is_https() ? 1 : 0;
|
||||
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
|
||||
new lang_string('enablemobilewebservice', 'admin'),
|
||||
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'admin'), new lang_string('configmobilecssurl','admin'), '', PARAM_URL));
|
||||
$ADMIN->add('webservicesettings', $temp);
|
||||
/// overview page
|
||||
|
@ -7691,6 +7691,12 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox {
|
||||
public function get_setting() {
|
||||
global $CFG;
|
||||
|
||||
// First check if is not set.
|
||||
$result = $this->config_read($this->name);
|
||||
if (is_null($result)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// For install cli script, $CFG->defaultuserroleid is not set so return 0
|
||||
// Or if web services aren't enabled this can't be,
|
||||
if (empty($CFG->defaultuserroleid) || empty($CFG->enablewebservices)) {
|
||||
@ -7701,7 +7707,7 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox {
|
||||
$webservicemanager = new webservice();
|
||||
$mobileservice = $webservicemanager->get_external_service_by_shortname(MOODLE_OFFICIAL_MOBILE_SERVICE);
|
||||
if ($mobileservice->enabled and $this->is_protocol_cap_allowed()) {
|
||||
return $this->config_read($this->name); //same as returning 1
|
||||
return $result;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user