Merge branch 'MDL-56971-m' of https://github.com/micaherne/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 6 Dec 2016 11:08:08 +0000 (11:08 +0000)
committerDan Poltawski <dan@moodle.com>
Tue, 6 Dec 2016 11:08:08 +0000 (11:08 +0000)
lib/enrollib.php

index 4849b07..452a899 100644 (file)
@@ -145,13 +145,15 @@ function enrol_get_plugin($name) {
 
     $location = "$CFG->dirroot/enrol/$name";
 
-    if (!file_exists("$location/lib.php")) {
-        return null;
-    }
-    include_once("$location/lib.php");
     $class = "enrol_{$name}_plugin";
     if (!class_exists($class)) {
-        return null;
+        if (!file_exists("$location/lib.php")) {
+            return null;
+        }
+        include_once("$location/lib.php");
+        if (!class_exists($class)) {
+            return null;
+        }
     }
 
     return new $class();