]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18676 auth plugins should run before enrol because it may create new users -...
authorskodak <skodak>
Thu, 26 Mar 2009 19:56:11 +0000 (19:56 +0000)
committerskodak <skodak>
Thu, 26 Mar 2009 19:56:11 +0000 (19:56 +0000)
admin/cron.php

index fa15f56b21b37197cc531cc1bf50b605551b3e7d..a06ad3d824ed76d750922c715a808641ce828219 100644 (file)
         }
     }
 
-/// Run the enrolment cron, if any
-    if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
-        $plugins = array($CFG->enrol);
-    }
-    require_once($CFG->dirroot .'/enrol/enrol.class.php');
-    foreach ($plugins as $p) {
-        $enrol = enrolment_factory::factory($p);
-        if (method_exists($enrol, 'cron')) {
-            $enrol->cron();
-        }
-        if (!empty($enrol->log)) {
-            mtrace($enrol->log);
-        }
-        unset($enrol);
-    }
-
 /// Run the auth cron, if any
+/// before enrolments because it might add users that will be needed in enrol plugins
     $auths = get_enabled_auth_plugins();
 
     mtrace("Running auth crons if required...");
         unset($authplugin);
     }
 
+/// Run the enrolment cron, if any
+    if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
+        $plugins = array($CFG->enrol);
+    }
+    require_once($CFG->dirroot .'/enrol/enrol.class.php');
+    foreach ($plugins as $p) {
+        $enrol = enrolment_factory::factory($p);
+        if (method_exists($enrol, 'cron')) {
+            $enrol->cron();
+        }
+        if (!empty($enrol->log)) {
+            mtrace($enrol->log);
+        }
+        unset($enrol);
+    }
+
     if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
         require_once($CFG->dirroot.'/lib/statslib.php');
         // check we're not before our runtime