Merged branch 'MDL-27781' of git://github.com/mouneyrac/moodle.git with changes
authorSam Hemelryk <sam@moodle.com>
Mon, 13 Jun 2011 02:54:24 +0000 (10:54 +0800)
committerSam Hemelryk <sam@moodle.com>
Mon, 13 Jun 2011 02:54:24 +0000 (10:54 +0800)
1  2 
lib/adminlib.php

@@@ -6569,11 -6569,17 +6569,17 @@@ class admin_setting_enablemobileservic
       */
      public function get_setting() {
          global $CFG;
-         $webservicesystem = $CFG->enablewebservices;
 -        //for install cli script, $CFG->defaultuserroleid is not set so return 0
 -        if (empty($CFG->defaultuserroleid)) {
++        // 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;
+         }
 -        $webservicesystem = $CFG->enablewebservices;
          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;