mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16284] Provide tables as array in migrations
PHPBB3-16284
This commit is contained in:
parent
6c0137c7a3
commit
a72810465f
3 changed files with 34 additions and 9 deletions
|
@ -11,6 +11,7 @@ services:
|
||||||
- '%core.root_path%'
|
- '%core.root_path%'
|
||||||
- '%core.php_ext%'
|
- '%core.php_ext%'
|
||||||
- '%core.table_prefix%'
|
- '%core.table_prefix%'
|
||||||
|
- '%tables%'
|
||||||
- '@migrator.tool_collection'
|
- '@migrator.tool_collection'
|
||||||
- '@migrator.helper'
|
- '@migrator.helper'
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ abstract class migration implements migration_interface
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $table_prefix;
|
protected $table_prefix;
|
||||||
|
|
||||||
|
/** @var array Tables array */
|
||||||
|
protected $tables;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $phpbb_root_path;
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
@ -55,13 +58,15 @@ abstract class migration implements migration_interface
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param string $php_ext
|
* @param string $php_ext
|
||||||
* @param string $table_prefix
|
* @param string $table_prefix
|
||||||
|
* @param array $tables
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
|
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix, $tables)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->db_tools = $db_tools;
|
$this->db_tools = $db_tools;
|
||||||
$this->table_prefix = $table_prefix;
|
$this->table_prefix = $table_prefix;
|
||||||
|
$this->tables = $tables;
|
||||||
|
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
|
|
|
@ -13,8 +13,12 @@
|
||||||
|
|
||||||
namespace phpbb\db;
|
namespace phpbb\db;
|
||||||
|
|
||||||
|
use phpbb\config\config;
|
||||||
|
use phpbb\db\driver\driver_interface;
|
||||||
|
use phpbb\db\migration\helper;
|
||||||
use phpbb\db\output_handler\migrator_output_handler_interface;
|
use phpbb\db\output_handler\migrator_output_handler_interface;
|
||||||
use phpbb\db\output_handler\null_migrator_output_handler;
|
use phpbb\db\output_handler\null_migrator_output_handler;
|
||||||
|
use phpbb\db\tools\tools_interface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
@ -28,21 +32,24 @@ class migrator
|
||||||
*/
|
*/
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
/** @var \phpbb\config\config */
|
/** @var config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/** @var \phpbb\db\driver\driver_interface */
|
/** @var driver_interface */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/** @var \phpbb\db\tools\tools_interface */
|
/** @var tools_interface */
|
||||||
protected $db_tools;
|
protected $db_tools;
|
||||||
|
|
||||||
/** @var \phpbb\db\migration\helper */
|
/** @var helper */
|
||||||
protected $helper;
|
protected $helper;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $table_prefix;
|
protected $table_prefix;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
protected $tables;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $phpbb_root_path;
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
@ -92,9 +99,20 @@ class migrator
|
||||||
protected $output_handler;
|
protected $output_handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the database migrator
|
* Constructor of the database migrator
|
||||||
*/
|
* @param ContainerInterface $container
|
||||||
public function __construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper)
|
* @param config $config
|
||||||
|
* @param driver\driver_interface $db
|
||||||
|
* @param tools\tools_interface $db_tools
|
||||||
|
* @param $migrations_table
|
||||||
|
* @param $phpbb_root_path
|
||||||
|
* @param $php_ext
|
||||||
|
* @param $table_prefix
|
||||||
|
* @param $tables
|
||||||
|
* @param $tools
|
||||||
|
* @param migration\helper $helper
|
||||||
|
*/
|
||||||
|
public function __construct(ContainerInterface $container, config $config, driver_interface $db, tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tables, $tools, helper $helper)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -108,6 +126,7 @@ class migrator
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
|
|
||||||
$this->table_prefix = $table_prefix;
|
$this->table_prefix = $table_prefix;
|
||||||
|
$this->tables = $tables;
|
||||||
|
|
||||||
$this->output_handler = new null_migrator_output_handler();
|
$this->output_handler = new null_migrator_output_handler();
|
||||||
|
|
||||||
|
@ -950,7 +969,7 @@ class migrator
|
||||||
*/
|
*/
|
||||||
protected function get_migration($name)
|
protected function get_migration($name)
|
||||||
{
|
{
|
||||||
$migration = new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix);
|
$migration = new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix, $this->tables);
|
||||||
|
|
||||||
if ($migration instanceof ContainerAwareInterface)
|
if ($migration instanceof ContainerAwareInterface)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue