diff --git a/admin/cli/install.php b/admin/cli/install.php index fcd25b248fa..1d97e606cd0 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -189,6 +189,14 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/componentlib.class.php'); require_once($CFG->dirroot.'/cache/lib.php'); +// Register our classloader, in theory somebody might want to replace it to load other hacked core classes. +// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes. +if (defined('COMPONENT_CLASSLOADER')) { + spl_autoload_register(COMPONENT_CLASSLOADER); +} else { + spl_autoload_register('core_component::classloader'); +} + require($CFG->dirroot.'/version.php'); $CFG->target_release = $release; diff --git a/install.php b/install.php index 899ebd35e38..c1c40ca6823 100644 --- a/install.php +++ b/install.php @@ -221,6 +221,14 @@ ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include //point zend include path to moodles lib/zend so that includes and requires will search there for files before anywhere else ini_set('include_path', $CFG->libdir.'/zend' . PATH_SEPARATOR . ini_get('include_path')); +// Register our classloader, in theory somebody might want to replace it to load other hacked core classes. +// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes. +if (defined('COMPONENT_CLASSLOADER')) { + spl_autoload_register(COMPONENT_CLASSLOADER); +} else { + spl_autoload_register('core_component::classloader'); +} + require('version.php'); $CFG->target_release = $release;