public static function bootstrapPackages($ignoreInstaller = FALSE) { if (Bluebox_Installer::is_installing() and $ignoreInstaller !== TRUE) { return TRUE; } $installedPackages = Doctrine::getTable('Package')->findByStatus(Package_Manager::STATUS_INSTALLED); if (empty($installedPackages)) { return FALSE; } $loadList = $navigation = array(); foreach ($installedPackages as $package) { $packageDir = DOCROOT . $package['basedir']; $loadList[$package['name']] = $packageDir; if (is_dir($packageDir . '/models')) { // Note that with MODEL_LOADING_CONSERVATIVE set, the model isn't really loaded until first requested Doctrine::loadModels($packageDir . '/models', Doctrine::MODEL_LOADING_CONSERVATIVE); } if (empty($package['navigation'])) { continue; } $navigation[$package['name']] = $package['navigation']; } $loadedModules = Kohana::config('core.modules'); $systemModules = array_unique(array_merge($loadedModules, $loadList)); Kohana::config_set('core.modules', $systemModules); foreach ($loadList as $packageDir) { // Load hooks only for modules in the DB, if hooks are enabled if (Kohana::config('core.enable_hooks') === TRUE) { if (is_dir($packageDir . '/hooks')) { // Since we're running late, we need to go grab // the hook files again (sad but true) $hooks = Kohana::list_files('hooks', TRUE, $packageDir . '/hooks'); foreach ($hooks as $file) { // Load the hook include_once $file; } } } } navigation::bootstrap($navigation); }