From 29908e54bcdf734150371fded932d04042580505 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 18 Oct 2015 17:31:12 +0200 Subject: [ticket/14039] Use shared language service in the container factory PHPBB3-14039 --- .../installer/container/services_installer.yml | 1 + phpBB/phpbb/install/helper/container_factory.php | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index 0072402d3c..939dd225b9 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -59,6 +59,7 @@ services: installer.helper.container_factory: class: phpbb\install\helper\container_factory arguments: + - @language - @request - %core.root_path% - %core.php_ext% diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index 8c007de39f..efbe278628 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -15,9 +15,16 @@ namespace phpbb\install\helper; use phpbb\cache\driver\dummy; use phpbb\install\exception\cannot_build_container_exception; +use phpbb\language\language; +use phpbb\request\request; class container_factory { + /** + * @var language + */ + protected $language; + /** * @var string */ @@ -43,12 +50,14 @@ class container_factory /** * Constructor * - * @param \phpbb\request\request $request Request interface - * @param string $phpbb_root_path Path to phpBB's root - * @param string $php_ext Extension of PHP files + * @param language $language Language service + * @param request $request Request interface + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files */ - public function __construct(\phpbb\request\request $request, $phpbb_root_path, $php_ext) + public function __construct(language $language, request $request, $phpbb_root_path, $php_ext) { + $this->language = $language; $this->request = $request; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -150,6 +159,9 @@ class container_factory $this->container->register('request')->setSynthetic(true); $this->container->set('request', $this->request); + $this->container->register('language')->setSynthetic(true); + $this->container->set('language', $this->language); + // Replace cache service, as config gets cached, and we don't want that when we are installing if (!is_dir($other_config_path)) { -- cgit v1.2.1