From 89114f77fae1495013101e0efe68193586e5f76a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 17 Dec 2021 17:59:59 +0000 Subject: [PATCH] MDL-73414 webservice: don't disable all WS when disabling mobile. --- lib/adminlib.php | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index 37708863a60..66517a883cf 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -9831,33 +9831,8 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox { // Allow rest:use capability for authenticated user. $this->set_protocol_cap(true); - } else { - //disable web service system if no other services are enabled - $otherenabledservices = $DB->get_records_select('external_services', - 'enabled = :enabled AND (shortname != :shortname OR shortname IS NULL)', array('enabled' => 1, - 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE)); - if (empty($otherenabledservices)) { - set_config('enablewebservices', false); - - // Also disable REST server. - $activeprotocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols); - - $protocolkey = array_search('rest', $activeprotocols); - if ($protocolkey !== false) { - unset($activeprotocols[$protocolkey]); - $updateprotocol = true; - } - - if ($updateprotocol) { - set_config('webserviceprotocols', implode(',', $activeprotocols)); - } - - // Disallow rest:use capability for authenticated user. - $this->set_protocol_cap(false); - } - - //disable the mobile service + // Disable the mobile service. $mobileservice = $webservicemanager->get_external_service_by_shortname(MOODLE_OFFICIAL_MOBILE_SERVICE); $mobileservice->enabled = 0; $webservicemanager->update_external_service($mobileservice);