[feature/dic] Move class loader into DIC

PHPBB3-10739
This commit is contained in:
Igor Wiedler 2012-03-31 20:45:33 +02:00
parent bca600877c
commit 873630f04e
2 changed files with 26 additions and 12 deletions

View file

@ -88,12 +88,6 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx");
$phpbb_class_loader_ext->register();
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx");
$phpbb_class_loader->register();
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/config'));
$loader->load('parameters.yml');
@ -102,6 +96,12 @@ $loader->load('services.yml');
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $phpEx);
// Setup class loader first
$phpbb_class_loader_ext = $container->get('class_loader.ext');
$phpbb_class_loader_ext->register();
$phpbb_class_loader = $container->get('class_loader');
$phpbb_class_loader->register();
// set up caching
$cache = $container->get('cache');
$phpbb_class_loader_ext->set_cache($container->get('cache.driver'));
@ -124,13 +124,12 @@ set_config_count(null, null, null, $config);
// load extensions
$phpbb_extension_manager = $container->get('ext.manager');
$phpbb_subscriber_loader = $container->get('event.subscriber_loader');
$phpbb_subscriber_loader->load();
$template = $container->get('template');
$style = $container->get('style');
$phpbb_subscriber_loader = $container->get('event.subscriber_loader');
$phpbb_subscriber_loader->load();
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));

View file

@ -1,13 +1,28 @@
services:
class_loader:
class: phpbb_class_loader
arguments:
- phpbb_
- %core.root_path%includes/
- .%core.php_ext%
class_loader.ext:
class: phpbb_class_loader
arguments:
- phpbb_ext_
- %core.root_path%ext/
- .%core.php_ext%
cache:
class: phpbb_cache_service
arguments:
- @cache.driver
cache.driver:
class: phpbb_cache_driver_interface
arguments:
- %cache.driver.class%
class: %cache.driver.class%
cache.driver.install:
class: phpbb_cache_driver_file
dispatcher:
class: phpbb_event_dispatcher