From ec90f2b380a598a3dbf7ada0e95878d9d1b85cbe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Dec 2014 16:34:02 +0100 Subject: [ticket/13421] Move tools to subdirectory PHPBB3-13421 --- phpBB/phpbb/db/migration/schema_generator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/db/migration/schema_generator.php') diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index 91d8307d91..7003844bc4 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -24,7 +24,7 @@ class schema_generator /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var array */ @@ -48,7 +48,7 @@ class schema_generator /** * Constructor */ - public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $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_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) { $this->config = $config; $this->db = $db; -- cgit v1.2.1 From 7d2a58e27100e5c776b44223e2cc6837c293db02 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 26 Jan 2016 11:45:06 -0800 Subject: [ticket/14434] Schema generator should ignore migration helpers PHPBB3-14434 --- phpBB/phpbb/db/migration/schema_generator.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/db/migration/schema_generator.php') diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index 7003844bc4..55ab4452ed 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -77,8 +77,18 @@ class schema_generator $check_dependencies = true; while (!empty($migrations)) { - foreach ($migrations as $migration_class) + foreach ($migrations as $key => $migration_class) { + if (class_exists($migration_class)) + { + $reflector = new \ReflectionClass($migration_class); + if (!$reflector->implementsInterface('\phpbb\db\migration\migration_interface') || !$reflector->isInstantiable()) + { + unset($migrations[$key]); + continue; + } + } + $open_dependencies = array_diff($migration_class::depends_on(), $tree); if (empty($open_dependencies)) -- cgit v1.2.1 From 47d8aeebde6f763ec7247daf0df16dd2388b25b6 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 27 Jan 2016 10:50:22 -0800 Subject: [ticket/14434] Extract migration check to a reusable method PHPBB3-14434 --- phpBB/phpbb/db/migration/schema_generator.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb/db/migration/schema_generator.php') diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index 55ab4452ed..dc685bb161 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -79,14 +79,12 @@ class schema_generator { foreach ($migrations as $key => $migration_class) { - if (class_exists($migration_class)) + // Unset classes that do not exist or do not extend the + // abstract class phpbb\db\migration\migration + if (\phpbb\db\migrator::is_migration($migration_class) === false) { - $reflector = new \ReflectionClass($migration_class); - if (!$reflector->implementsInterface('\phpbb\db\migration\migration_interface') || !$reflector->isInstantiable()) - { - unset($migrations[$key]); - continue; - } + unset($migrations[$key]); + continue; } $open_dependencies = array_diff($migration_class::depends_on(), $tree); -- cgit v1.2.1 From 3bd8a2ba196f240c5b982271af1ee8b2a2f8332b Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 27 Jan 2016 11:46:04 -0800 Subject: [ticket/14434] Remove recursion to simplify is_migration method PHPBB3-14434 --- phpBB/phpbb/db/migration/schema_generator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/phpbb/db/migration/schema_generator.php') diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index dc685bb161..c579e25824 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -79,8 +79,7 @@ class schema_generator { foreach ($migrations as $key => $migration_class) { - // Unset classes that do not exist or do not extend the - // abstract class phpbb\db\migration\migration + // Unset classes that are not a valid migration if (\phpbb\db\migrator::is_migration($migration_class) === false) { unset($migrations[$key]); -- cgit v1.2.1