Merge pull request #4016 from CHItA/ticket/14270

[ticket/14270] Purge cache when the installer is finished

* CHItA/ticket/14270:
  [ticket/14270] Purge cache when the installer is finished
This commit is contained in:
Tristan Darricau 2015-11-23 22:02:24 +01:00
commit f283f5bd03
7 changed files with 26 additions and 9 deletions

View file

@ -9,6 +9,11 @@ imports:
- { resource: ../../default/container/services_twig.yml }
services:
cache.driver:
class: %cache.driver.class%
arguments:
- "%core.root_path%/cache/installer/"
config:
class: phpbb\config\config
arguments:

View file

@ -86,6 +86,7 @@ services:
class: phpbb\install\installer
abstract: true
arguments:
- @cache.driver
- @installer.helper.config
- @path_helper

View file

@ -30,7 +30,6 @@ $phpbb_filesystem = $phpbb_installer_container->get('filesystem');
/** @var \phpbb\template\template $template */
$template = $phpbb_installer_container->get('template');
// Path to templates
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
@ -42,17 +41,17 @@ $template->set_custom_style(array(
),
), $paths);
/* @var $phpbb_dispatcher \phpbb\event\dispatcher */
/** @var $phpbb_dispatcher \phpbb\event\dispatcher */
$phpbb_dispatcher = $phpbb_installer_container->get('dispatcher');
/** @var \phpbb\language\language $language */
$language = $phpbb_installer_container->get('language');
$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
/* @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */
/** @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */
$http_kernel = $phpbb_installer_container->get('http_kernel');
/* @var $symfony_request \phpbb\symfony_request */
/** @var $symfony_request \phpbb\symfony_request */
$symfony_request = $phpbb_installer_container->get('symfony_request');
$response = $http_kernel->handle($symfony_request);
$response->send();

View file

@ -81,4 +81,5 @@ $config_path = (file_exists($other_config_path . '/installer/config.yml')) ? $ot
$phpbb_installer_container = $phpbb_installer_container_builder
->with_config_path($config_path)
->with_custom_parameters(array('cache.driver.class' => 'phpbb\cache\driver\file'))
->get_container();

View file

@ -13,6 +13,7 @@
namespace phpbb\install;
use phpbb\cache\driver\driver_interface;
use phpbb\di\ordered_service_collection;
use phpbb\install\exception\installer_config_not_writable_exception;
use phpbb\install\exception\jump_to_restart_point_exception;
@ -25,6 +26,11 @@ use phpbb\path_helper;
class installer
{
/**
* @var driver_interface
*/
protected $cache;
/**
* @var config
*/
@ -55,11 +61,13 @@ class installer
/**
* Constructor
*
* @param driver_interface $cache Cache service
* @param config $config Installer config handler
* @param path_helper $path_helper Path helper
*/
public function __construct(config $config, path_helper $path_helper)
public function __construct(driver_interface $cache, config $config, path_helper $path_helper)
{
$this->cache = $cache;
$this->install_config = $config;
$this->installer_modules = null;
$this->web_root = $path_helper->get_web_root_path();
@ -235,6 +243,7 @@ class installer
if ($install_finished || $fail_cleanup)
{
$this->install_config->clean_up_config_file();
$this->cache->purge();
}
else
{

View file

@ -295,7 +295,8 @@ class phpbb_functional_test_case extends phpbb_test_case
'installer.create_config_file.options' => [
'debug' => true,
'environment' => 'test',
]
],
'cache.driver.class' => 'phpbb\cache\driver\file'
])
->without_compiled_container()
->get_container();

View file

@ -128,7 +128,8 @@ class phpbb_ui_test_case extends phpbb_test_case
'installer.create_config_file.options' => [
'debug' => true,
'environment' => 'test',
]
],
'cache.driver.class' => 'phpbb\cache\driver\file'
])
->without_compiled_container()
->get_container();