mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/13489] Fix service configuration
PHPBB3-13489
This commit is contained in:
parent
ce47170c29
commit
dab0728357
6 changed files with 45 additions and 50 deletions
|
@ -18,6 +18,7 @@ services:
|
||||||
migrator:
|
migrator:
|
||||||
class: phpbb\db\migrator
|
class: phpbb\db\migrator
|
||||||
arguments:
|
arguments:
|
||||||
|
- @service_container
|
||||||
- @config
|
- @config
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @dbal.tools
|
- @dbal.tools
|
||||||
|
|
36
phpBB/phpbb/db/migration/container_aware_migration.php
Normal file
36
phpBB/phpbb/db/migration/container_aware_migration.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\db\migration;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base class for container aware database migrations.
|
||||||
|
*/
|
||||||
|
abstract class container_aware_migration extends migration implements ContainerAwareInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var ContainerInterface
|
||||||
|
*/
|
||||||
|
protected $container;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setContainer(ContainerInterface $container = null)
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,16 +13,10 @@
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v30x;
|
namespace phpbb\db\migration\data\v30x;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use phpbb\db\migration\container_aware_migration;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
class release_3_0_5_rc1 extends \phpbb\db\migration\migration implements ContainerAwareInterface
|
class release_3_0_5_rc1 extends container_aware_migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
public function effectively_installed()
|
public function effectively_installed()
|
||||||
{
|
{
|
||||||
return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
|
return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
|
||||||
|
@ -136,12 +130,4 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration implements Contain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setContainer(ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,21 +13,15 @@
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v310;
|
namespace phpbb\db\migration\data\v310;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use phpbb\db\migration\container_aware_migration;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Migration to convert the Soft Delete MOD for 3.0
|
* Migration to convert the Soft Delete MOD for 3.0
|
||||||
*
|
*
|
||||||
* https://www.phpbb.com/customise/db/mod/soft_delete/
|
* https://www.phpbb.com/customise/db/mod/soft_delete/
|
||||||
*/
|
*/
|
||||||
class soft_delete_mod_convert extends \phpbb\db\migration\migration implements ContainerAwareInterface
|
class soft_delete_mod_convert extends container_aware_migration
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
@ -130,12 +124,4 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration implements C
|
||||||
{
|
{
|
||||||
return $this->container->get('content.visibility');
|
return $this->container->get('content.visibility');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setContainer(ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\db\migration;
|
namespace phpbb\db\migration;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
abstract class profilefield_base_migration extends container_aware_migration
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
abstract class profilefield_base_migration extends \phpbb\db\migration\migration implements ContainerAwareInterface
|
|
||||||
{
|
{
|
||||||
protected $profilefield_name;
|
protected $profilefield_name;
|
||||||
|
|
||||||
|
@ -43,11 +40,6 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
|
||||||
|
|
||||||
protected $user_column_name;
|
protected $user_column_name;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
public function effectively_installed()
|
public function effectively_installed()
|
||||||
{
|
{
|
||||||
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_' . $this->profilefield_name);
|
return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_' . $this->profilefield_name);
|
||||||
|
@ -251,12 +243,4 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
|
||||||
|
|
||||||
return $profile_row;
|
return $profile_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setContainer(ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
$db = $this->get_db();
|
$db = $this->get_db();
|
||||||
$db_tools = new \phpbb\db\tools($db);
|
$db_tools = new \phpbb\db\tools($db);
|
||||||
|
|
||||||
|
$container = new phpbb_mock_container_builder();
|
||||||
$migrator = new \phpbb\db\migrator(
|
$migrator = new \phpbb\db\migrator(
|
||||||
|
$container,
|
||||||
$config,
|
$config,
|
||||||
$db,
|
$db,
|
||||||
$db_tools,
|
$db_tools,
|
||||||
|
@ -238,8 +240,8 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
array(),
|
array(),
|
||||||
new \phpbb\db\migration\helper()
|
new \phpbb\db\migration\helper()
|
||||||
);
|
);
|
||||||
$container = new phpbb_mock_container_builder();
|
|
||||||
$container->set('migrator', $migrator);
|
$container->set('migrator', $migrator);
|
||||||
|
$container->set('dispatcher', new phpbb_mock_event_dispatcher());
|
||||||
$user = new \phpbb\user('\phpbb\datetime');
|
$user = new \phpbb\user('\phpbb\datetime');
|
||||||
|
|
||||||
$extension_manager = new \phpbb\extension\manager(
|
$extension_manager = new \phpbb\extension\manager(
|
||||||
|
|
Loading…
Add table
Reference in a new issue