"Files are included based on the file path given or, if none is given,
the include_path specified. If the file isn't found in the include_path,
include will finally check in the calling script's own directory and the
current working directory before failing. "
In some cases, the require_once('locallib.php') call was finding other
instances of locallib.php in the moodle code and ending, rather than
loading this plugins code.
Notably, I experienced this with attempts to recover grade histories
for students getting re-enrolled in courses with an instance of this
module in their grade history
From: https://secure.php.net/manual/en/function.include.php
"Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing. "
In some cases, the require_once('locallib.php') call was finding other instances of locallib.php in the moodle code and ending, rather than loading this plugins code.
Notably, I experienced this with attempts to recover grade histories for students getting re-enrolled in courses with an instance of this module in their grade history