1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-14 04:42:04 +02:00

[ticket/16284] Provide tables as array in migrations

PHPBB3-16284
This commit is contained in:
Marc Alexander 2020-01-01 12:08:11 +01:00
parent 6c0137c7a3
commit a72810465f
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
3 changed files with 34 additions and 9 deletions
phpBB
config/default/container
phpbb/db

@ -11,6 +11,7 @@ services:
- '%core.root_path%'
- '%core.php_ext%'
- '%core.table_prefix%'
- '%tables%'
- '@migrator.tool_collection'
- '@migrator.helper'

@ -34,6 +34,9 @@ abstract class migration implements migration_interface
/** @var string */
protected $table_prefix;
/** @var array Tables array */
protected $tables;
/** @var string */
protected $phpbb_root_path;
@ -55,13 +58,15 @@ abstract class migration implements migration_interface
* @param string $phpbb_root_path
* @param string $php_ext
* @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->db = $db;
$this->db_tools = $db_tools;
$this->table_prefix = $table_prefix;
$this->tables = $tables;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

@ -13,8 +13,12 @@
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\null_migrator_output_handler;
use phpbb\db\tools\tools_interface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -28,21 +32,24 @@ class migrator
*/
protected $container;
/** @var \phpbb\config\config */
/** @var config */
protected $config;
/** @var \phpbb\db\driver\driver_interface */
/** @var driver_interface */
protected $db;
/** @var \phpbb\db\tools\tools_interface */
/** @var tools_interface */
protected $db_tools;
/** @var \phpbb\db\migration\helper */
/** @var helper */
protected $helper;
/** @var string */
protected $table_prefix;
/** @var array */
protected $tables;
/** @var string */
protected $phpbb_root_path;
@ -92,9 +99,20 @@ class migrator
protected $output_handler;
/**
* Constructor of the database migrator
*/
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)
* Constructor of the database migrator
* @param ContainerInterface $container
* @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->config = $config;
@ -108,6 +126,7 @@ class migrator
$this->php_ext = $php_ext;
$this->table_prefix = $table_prefix;
$this->tables = $tables;
$this->output_handler = new null_migrator_output_handler();
@ -950,7 +969,7 @@ class migrator
*/
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)
{