Browse files

Merged branch 'MDL-27781' of git://github.com/mouneyrac/moodle.git wi…

…th changes
  • Loading branch information...
2 parents 85ee4e3 + 565e477 commit 178ac9033b9448617285d10bb1a01ef5f578fd2b Sam Hemelryk committed Jun 13, 2011
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/adminlib.php
View
16 lib/adminlib.php
@@ -6569,11 +6569,17 @@ public function output_html($data, $query='') {
*/
public function get_setting() {
global $CFG;
- $webservicesystem = $CFG->enablewebservices;
+
+ // 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)) {
+ return 0;
+ }
+
require_once($CFG->dirroot . '/webservice/lib.php');
$webservicemanager = new webservice();
$mobileservice = $webservicemanager->get_external_service_by_shortname(MOODLE_OFFICIAL_MOBILE_SERVICE);
- if ($mobileservice->enabled and !empty($webservicesystem) and $this->is_xmlrpc_cap_allowed()) {
+ if ($mobileservice->enabled and $this->is_xmlrpc_cap_allowed()) {
return $this->config_read($this->name); //same as returning 1
} else {
return 0;
@@ -6588,6 +6594,12 @@ public function get_setting() {
*/
public function write_setting($data) {
global $DB, $CFG;
+
+ //for install cli script, $CFG->defaultuserroleid is not set so do nothing
+ if (empty($CFG->defaultuserroleid)) {
+ return '';
+ }
+
$servicename = MOODLE_OFFICIAL_MOBILE_SERVICE;
require_once($CFG->dirroot . '/webservice/lib.php');

0 comments on commit 178ac90

Please sign in to comment.