/** * Method to add a module bootstrap to list of possibles active modules. * @param App_Application_Module_Bootstrap $bootstrap */ public function addModuleBootstrap(App_Application_Module_Bootstrap $bootstrap) { if (isset($bootstrap)) { $this->_bootstraps[strtolower($bootstrap->getModuleName())] = $bootstrap; } return $this; }
/** * Constructor * * Load initial module config. * * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application * @return void */ public function __construct($application, $useCache = true) { parent::__construct($application); $this->getResourceLoaderPhpNamespaces(); if ($useCache) { $caches = $this->getApplication()->getResource('cachemanager')->getCaches(); $this->_cache = $caches ? array_shift($caches) : null; } $configFile = implode(DIRECTORY_SEPARATOR, array($this->getResourceLoader()->getBasePath(), 'config', 'config.ini')); $cacheKey = $this->getModuleName() . '_config'; if (!isset($this->_cache) || !($options = $this->_cache->load($cacheKey)) || !$options instanceof Zend_Config) { if (file_exists($configFile)) { $options = new Zend_Config_Ini($configFile, $this->getEnvironment()); if (isset($this->_cache)) { $this->_cache->save($options, $cacheKey, array(), null); } } } if (isset($options) && $options) { $this->setOptions($options->toArray()); } $activePlugin = $this->getApplication()->getResource('frontcontroller')->getPlugin('App_Controller_Plugin_ActiveModuleBootstrap'); if ($activePlugin) { $activePlugin->addModuleBootstrap($this); } }