/** * Setup global class map and loader instances and add the core classes to the map. * We can't load this from dataroot because we don't know it yet, and we'll need * several classes before we can find out! * * @throws InstallationException * @access private */ function _elgg_setup_autoload() { global $CONFIG; // manually load classes needed for autoloading $dir = dirname(dirname(__FILE__)) . '/classes'; foreach (array('ElggClassMap', 'ElggClassLoader', 'ElggAutoloadManager') as $class) { $file = "{$dir}/{$class}.php"; if (!(include $file)) { throw new InstallationException("Could not load {$file}"); } } $loader = new ElggClassLoader(new ElggClassMap()); // until the cache can be loaded, just setup PSR-0 autoloading // out of the classes directory. No need to build a full map. $loader->addFallback($dir); $loader->register(); $manager = new ElggAutoloadManager($loader); $CONFIG->autoload_manager = $manager; }
/** * Set the state of the manager from the cache * * @return bool was the cache loaded? */ public function loadCache() { $spec = $this->getSpec(); if ($spec) { // the cached class map will have the full scanned core classes, so // don't consider the earlier mappings as "altering" the map $this->loader->getClassMap()->setMap($spec[self::KEY_CLASSES])->setAltered(false); $this->scannedDirs = $spec[self::KEY_SCANNED_DIRS]; return true; } $this->altered = true; return false; }