1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-22 16:22:58 +02:00

[ticket/14462] Refactor tasks to be more modular

PHPBB3-14462
This commit is contained in:
Mate Bartus
2016-02-12 14:20:04 +01:00
parent 955b9ede33
commit 68091561ab
12 changed files with 874 additions and 182 deletions

View File

@@ -87,9 +87,13 @@ class notify_user extends \phpbb\install\task_base
$this->php_ext = $php_ext;
// We need to reload config for cases when it doesn't have all values
/** @var \phpbb\cache\driver\driver_interface $cache */
$cache = $container->get('cache.driver');
$cache->destroy('config');
$this->config = new db(
$container->get('dbal.conn'),
$container->get('cache.driver'),
$cache,
$container->get_parameter('tables.config')
);

View File

@@ -13,11 +13,20 @@
namespace phpbb\install\module\install_finish\task;
use phpbb\install\exception\resource_limit_reached_exception;
use phpbb\install\helper\config;
use phpbb\install\helper\container_factory;
/**
* Populates migrations
*/
class populate_migrations extends \phpbb\install\task_base
{
/**
* @var config
*/
protected $config;
/**
* @var \phpbb\extension\manager
*/
@@ -31,10 +40,12 @@ class populate_migrations extends \phpbb\install\task_base
/**
* Constructor
*
* @param \phpbb\install\helper\container_factory $container phpBB's DI contianer
* @param config $config Installer's config
* @param container_factory $container phpBB's DI contianer
*/
public function __construct(\phpbb\install\helper\container_factory $container)
public function __construct(config $config, container_factory $container)
{
$this->config = $config;
$this->extension_manager = $container->get('ext.manager');
$this->migrator = $container->get('migrator');
@@ -46,6 +57,15 @@ class populate_migrations extends \phpbb\install\task_base
*/
public function run()
{
if (!$this->config->get('populate_migration_refresh_before', false))
{
if ($this->config->get_time_remaining() < 1)
{
$this->config->set('populate_migration_refresh_before', true);
throw new resource_limit_reached_exception();
}
}
$finder = $this->extension_manager->get_finder();
$migrations = $finder