Skip to content

Commit

Permalink
MDL-83503 core: Fix include_modulelib
Browse files Browse the repository at this point in the history
* include_modulelib assumes that all mod plugins are in /mod/xxx
However, this does not happen when we fake the plugin. Adding
an alternative whilst keeping the "direct" check that was done before.
  • Loading branch information
laurentdavid committed Oct 22, 2024
1 parent ecfcf00 commit 8aee4a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion course/modlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,13 @@ function include_modulelib($modulename) {
if (file_exists($modlib)) {
include_once($modlib);
} else {
throw new moodle_exception('modulemissingcode', '', '', $modlib);
$moddir = core_component::get_component_directory("mod_$modulename"); // Check if the module exists.
$modlib = "$moddir/lib.php";
if (file_exists($modlib)) {
include_once($modlib);
} else {
throw new moodle_exception('modulemissingcode', '', '', $modlib);
}
}
}

Expand Down

0 comments on commit 8aee4a2

Please sign in to comment.