Skip to content

Commit

Permalink
MDL-56971 enrol: Use autoloading in enrol_get_plugin()
Browse files Browse the repository at this point in the history
  • Loading branch information
micaherne authored and danpoltawski committed Dec 6, 2016
1 parent 1fac7b9 commit 9c68157
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/enrollib.php
Expand Up @@ -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();
Expand Down

0 comments on commit 9c68157

Please sign in to comment.