[ticket/14039] Use update helper to include files in container factory

PHPBB3-14039
This commit is contained in:
Mate Bartus 2015-10-19 09:12:26 +02:00
parent de729110c8
commit d45f146814
2 changed files with 16 additions and 24 deletions

View file

@ -61,6 +61,7 @@ services:
arguments: arguments:
- @language - @language
- @request - @request
- @installer.helper.update_helper
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%

View file

@ -40,6 +40,11 @@ class container_factory
*/ */
protected $request; protected $request;
/**
* @var update_helper
*/
protected $update_helper;
/** /**
* The full phpBB container * The full phpBB container
* *
@ -52,13 +57,15 @@ class container_factory
* *
* @param language $language Language service * @param language $language Language service
* @param request $request Request interface * @param request $request Request interface
* @param update_helper $update_helper Update helper
* @param string $phpbb_root_path Path to phpBB's root * @param string $phpbb_root_path Path to phpBB's root
* @param string $php_ext Extension of PHP files * @param string $php_ext Extension of PHP files
*/ */
public function __construct(language $language, request $request, $phpbb_root_path, $php_ext) public function __construct(language $language, request $request, update_helper $update_helper, $phpbb_root_path, $php_ext)
{ {
$this->language = $language; $this->language = $language;
$this->request = $request; $this->request = $request;
$this->update_helper = $update_helper;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->container = null; $this->container = null;
@ -180,24 +187,8 @@ class container_factory
$this->request->disable_super_globals(); $this->request->disable_super_globals();
} }
// Get compatibilty globals // Get compatibilty globals and constants
if (file_exists($this->phpbb_root_path . 'install/update/new/includes/compatibility_globals.' . $this->php_ext)) $this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext);
{ $this->update_helper->include_file('includes/constants.' . $this->php_ext);
require($this->phpbb_root_path . 'install/update/new/includes/compatibility_globals.' . $this->php_ext);
}
else
{
require($this->phpbb_root_path . 'includes/compatibility_globals.' . $this->php_ext);
}
// Get compatibilty globals
if (file_exists($this->phpbb_root_path . 'install/update/new/includes/constants.' . $this->php_ext))
{
require($this->phpbb_root_path . 'install/update/new/includes/constants.' . $this->php_ext);
}
else
{
require($this->phpbb_root_path . 'includes/constants.' . $this->php_ext);
}
} }
} }