X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=public%2Findex.php;h=26eefe6dfee00b9691dbd24ff11bd258309065d4;hb=8326bdcb7311bb5bddb4b253334e46e15a48d98c;hp=767893c7f452640d84f946293c35078e202d1a59;hpb=069c369af0d167f7bc1b359468f3136d50429747;p=zf2.biz%2Fgalerie.git diff --git a/public/index.php b/public/index.php index 767893c..26eefe6 100644 --- a/public/index.php +++ b/public/index.php @@ -1,20 +1,24 @@ array())); +chdir(dirname(__DIR__)); +require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php'; +Zend\Loader\AutoloaderFactory::factory(); -$appConfig = include dirname(__DIR__) . '/config/application.config.php'; +if (!($env = getenv('APPLICATION_ENV'))) { + $env = 'local'; +} -$moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']); -$moduleLoader->register(); +$appConfig = include 'config/application.config.php'; + +$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); +$defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions); +$defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/{global,$env}.config.php"); $moduleManager = new Zend\Module\Manager($appConfig['modules']); -$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); -$moduleManager->setDefaultListenerOptions($listenerOptions); -$moduleManager->getConfigListener()->addConfigGlobPath(dirname(__DIR__) . '/config/autoload/*.config.php'); +$moduleManager->events()->attachAggregate($defaultListeners); $moduleManager->loadModules(); // Create application, bootstrap, and run -$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig()); +$bootstrap = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig()); $application = new Zend\Mvc\Application; $bootstrap->bootstrap($application); $application->run()->send();