diff options
author | Nils Adermann <naderman@naderman.de> | 2012-09-01 19:21:24 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2012-09-01 19:21:24 +0200 |
commit | c539c2b0f9f736da816422320d6f58e6f414f54e (patch) | |
tree | 668e2e5658a1c7dac452e49081665d1bf7a86a39 /phpBB/download | |
parent | 66b60ddba848593c2e644d7784a3bde9872b2a24 (diff) | |
parent | 282a80077d4630ba59043fffe59e8a7ce8619ecb (diff) | |
download | forums-c539c2b0f9f736da816422320d6f58e6f414f54e.tar forums-c539c2b0f9f736da816422320d6f58e6f414f54e.tar.gz forums-c539c2b0f9f736da816422320d6f58e6f414f54e.tar.bz2 forums-c539c2b0f9f736da816422320d6f58e6f414f54e.tar.xz forums-c539c2b0f9f736da816422320d6f58e6f414f54e.zip |
Merge remote-tracking branch 'github-igorw/feature/dic' into develop
* github-igorw/feature/dic: (35 commits)
[feature/dic] Spaces to tabs, add useless docblocks
[feature/dic] Remove unneeded newline
[feature/dic] Add a doc block for the prune_forum cron task forum_data
[feature/dic] Update composer.lock to symfony/* RC1
[feature/dic] Fix re-ordering of services
[feature/dic] Fix parse errors
[feature/dic] Add docblock for cron_manager::wrap_task()
[feature/dic] Make cron task attributes protected, one per line
[feature/dic] Coding style: Braces
[feature/dic] Re-order services alphabetically
[feature/dic] Remove duplicate event-dispatcher dependency
[feature/dic] Adjust installer script to work with partially configured container
[feature/dic] Generate full cache driver class name on fresh install
[feature/dic] Adjust cache driver class name for BC
[feature/dic] Rename {phpEx => php_ext} for consistency
[feature/dic] Add trailing newline to htaccess
[feature/dic] Require symfony/* 2.1.*, tabs instead of spaces, --dev lock file
[feature/dic] Load services from extensions
[feature/dic] Introduce DI processors instead of abusing compiler passes
[feature/dic] Add dbal_ class prefix to dbal.driver.class
...
Diffstat (limited to 'phpBB/download')
-rw-r--r-- | phpBB/download/file.php | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php index b56d729a7b..8766c6d030 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -7,6 +7,10 @@ * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + /** * @ignore */ @@ -14,7 +18,6 @@ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); - // Thank you sun. if (isset($_SERVER['CONTENT_TYPE'])) { @@ -39,26 +42,38 @@ if (isset($_GET['avatar'])) } require($phpbb_root_path . 'includes/class_loader.' . $phpEx); + require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); + require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); + require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - $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(); + $phpbb_container = new ContainerBuilder(); + $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); + $loader->load('services.yml'); + + $processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); + $processor->process($phpbb_container); + + $phpbb_class_loader = $phpbb_container->get('class_loader'); + $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); + + $ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); + foreach ($ids as $id) + { + $processor = $phpbb_container->get($id); + $processor->process($phpbb_container); + } // set up caching - $cache_factory = new phpbb_cache_factory($acm_type); - $cache = $cache_factory->get_service(); - $phpbb_class_loader_ext->set_cache($cache->get_driver()); - $phpbb_class_loader->set_cache($cache->get_driver()); + $cache = $phpbb_container->get('cache'); - $phpbb_dispatcher = new phpbb_event_dispatcher(); - $request = new phpbb_request(); - $db = new $sql_db(); + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + $request = $phpbb_container->get('request'); + $db = $phpbb_container->get('dbal.conn'); // Connect to DB if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false)) @@ -69,18 +84,16 @@ if (isset($_GET['avatar'])) request_var('', 0, false, false, $request); - // worst-case default - $browser = strtolower($request->header('User-Agent', 'msie 6.0')); - - $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); + $config = $phpbb_container->get('config'); set_config(null, null, null, $config); set_config_count(null, null, null, $config); // load extensions - $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver()); + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); - $phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager); - $phpbb_subscriber_loader->load(); + // worst-case default + $browser = strtolower($request->header('User-Agent', 'msie 6.0')); $filename = request_var('avatar', ''); $avatar_group = false; |