[ticket/11459] Pass array with migration class names to schema generator

PHPBB3-11459
This commit is contained in:
Joas Schilling 2014-03-28 21:01:07 +01:00
parent ac6f0c94bf
commit b0aa366b12
2 changed files with 9 additions and 10 deletions

View file

@ -24,14 +24,13 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1); $phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'common.' . $phpEx);
$phpbb_extension_manager = $phpbb_container->get('ext.manager'); $classes = $phpbb_container->get('ext.manager')
$finder = $phpbb_extension_manager->get_finder(); ->get_finder()
$finder = $finder
->core_path('phpbb/db/migration/data/') ->core_path('phpbb/db/migration/data/')
->extension_prefix('migration/'); ->get_classes();
$db_tools = new \phpbb\db\tools($db, true); $db_tools = new \phpbb\db\tools($db, true);
$schema_generator = new \phpbb\db\migration\schema_generator($finder, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); $schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
$original_schema_data = $schema_generator->get_schema(); $original_schema_data = $schema_generator->get_schema();
$dbms_type_map = phpbb\db\tools::get_dbms_type_map(); $dbms_type_map = phpbb\db\tools::get_dbms_type_map();

View file

@ -25,8 +25,8 @@ class schema_generator
/** @var \phpbb\db\tools */ /** @var \phpbb\db\tools */
protected $db_tools; protected $db_tools;
/** @var \phpbb\extension\finder */ /** @var array */
protected $finder; protected $class_names;
/** @var string */ /** @var string */
protected $table_prefix; protected $table_prefix;
@ -43,12 +43,12 @@ class schema_generator
/** /**
* Constructor * Constructor
*/ */
public function __construct(\phpbb\extension\finder $finder, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
{ {
$this->config = $config; $this->config = $config;
$this->db = $db; $this->db = $db;
$this->db_tools = $db_tools; $this->db_tools = $db_tools;
$this->finder = $finder; $this->class_names = $class_names;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->table_prefix = $table_prefix; $this->table_prefix = $table_prefix;
@ -66,7 +66,7 @@ class schema_generator
return $this->tables; return $this->tables;
} }
$migrations = $this->finder->get_classes(); $migrations = $this->class_names;
$tree = array(); $tree = array();
while (!empty($migrations)) while (!empty($migrations))