MDL-25337 fixed invalid config test in enrol course sync, credit goes to Nick Thompson
[moodle.git] / enrol / database / lib.php
index 63aace9..5073aac 100644 (file)
@@ -244,7 +244,7 @@ class enrol_database_plugin extends enrol_plugin {
 
         // we may need a lot of memory here
         @set_time_limit(0);
-        @raise_memory_limit("512M");
+        raise_memory_limit(MEMORY_HUGE);
 
         $extdb = $this->db_init();
 
@@ -300,7 +300,7 @@ class enrol_database_plugin extends enrol_plugin {
                     if (!empty($mapping) and !isset($existing[$mapping])) {
                         $params['mapping'] = $mapping;
                         if ($course = $DB->get_record_sql($sql, $params, IGNORE_MULTIPLE)) {
-                            $new = new object();
+                            $new = new stdClass();
                             $new->id      = $course->id;
                             $new->visible = $course->visible;
                             $new->mapping = $mapping;
@@ -471,13 +471,13 @@ class enrol_database_plugin extends enrol_plugin {
         global $CFG, $DB;
 
         // make sure we sync either enrolments or courses
-        if (!$this->get_config('dbtype') or !$this->get_config('dbhost') or $this->get_config('newcoursetable') or $this->get_config('newcoursefullname') or $this->get_config('newcourseshortname')) {
+        if (!$this->get_config('dbtype') or !$this->get_config('dbhost') or !$this->get_config('newcoursetable') or !$this->get_config('newcoursefullname') or !$this->get_config('newcourseshortname')) {
             return;
         }
 
         // we may need a lot of memory here
         @set_time_limit(0);
-        @raise_memory_limit("512M");
+        raise_memory_limit(MEMORY_HUGE);
 
         $extdb = $this->db_init();
 
@@ -519,7 +519,7 @@ class enrol_database_plugin extends enrol_plugin {
                         // invalid category id, better to skip
                         continue;
                     }
-                    $course = new object();
+                    $course = new stdClass();
                     $course->fullname  = $fields[$fullname];
                     $course->shortname = $fields[$shortname];
                     $course->idnumber  = $idnumber ? $fields[$idnumber] : NULL;
@@ -546,10 +546,10 @@ class enrol_database_plugin extends enrol_plugin {
                     unset($template->shortname);
                     unset($template->idnumber);
                 } else {
-                    $template = new object();
+                    $template = new stdClass();
                 }
             } else {
-                $template = new object();
+                $template = new stdClass();
             }
             if (!$DB->record_exists('course_categories', array('id'=>$defaultcategory))) {
                 $categories = $DB->get_records('course_categories', array(), 'sortorder', 'id', 0, 1);