From c220fa89a1bf5652df6512ad78eb9ba550fe465e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Sep 2014 10:42:21 +0200 Subject: [PATCH 1/3] [ticket/12963] Revert back to "migrations" folder name for extensions The issues that can be created with the name change are just too much PHPBB3-12963 --- phpBB/install/database_update.php | 8 -------- phpBB/phpbb/console/command/db/migrate.php | 8 -------- phpBB/phpbb/extension/base.php | 11 +---------- tests/test_framework/phpbb_database_test_case.php | 9 --------- 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5cf01fec79..8016ff349b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -181,17 +181,9 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $migrations = $phpbb_extension_manager ->get_finder() ->core_path('phpbb/db/migration/data/') - ->extension_directory('/migration') - ->get_classes(); - -// @deprecated 3.1.0-RC4 (To be removed: 3.2.0) -$migrations_deprecated = $phpbb_extension_manager - ->get_finder() ->extension_directory('/migrations') ->get_classes(); -$migrations = array_merge($migrations, $migrations_deprecated); - $migrator->set_migrations($migrations); // What is a safe limit of execution time? Half the max execution time should be safe. diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 68638a9515..86545c237d 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -117,17 +117,9 @@ class migrate extends \phpbb\console\command\command $migrations = $this->extension_manager ->get_finder() ->core_path('phpbb/db/migration/data/') - ->extension_directory('/migration') - ->get_classes(); - - // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) - $migrations_deprecated = $this->extension_manager - ->get_finder() ->extension_directory('/migrations') ->get_classes(); - $migrations = array_merge($migrations, $migrations_deprecated); - $this->migrator->set_migrations($migrations); } diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index b74026e6ab..5bb530bad4 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -132,20 +132,11 @@ class base implements \phpbb\extension\extension_interface // Only have the finder search in this extension path directory $migrations = $this->extension_finder - ->extension_directory('/migration') + ->extension_directory('/migrations') ->find_from_extension($this->extension_name, $this->extension_path); $migrations = $this->extension_finder->get_classes_from_files($migrations); - // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) - $migrations_deprecated = $this->extension_finder - ->extension_directory('/migrations') - ->find_from_extension($this->extension_name, $this->extension_path); - - $migrations_deprecated = $this->extension_finder->get_classes_from_files($migrations_deprecated); - - $migrations = array_merge($migrations, $migrations_deprecated); - return $migrations; } } diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 6b19689b2f..0eeb52443c 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -71,19 +71,10 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); $classes = $finder->core_path('phpbb/') ->core_directory('db/migration/data/') - ->set_extensions($setup_extensions) - ->extension_directory('/migration') - ->get_classes(); - - // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) - $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); - $classes_deprecated = $finder ->set_extensions($setup_extensions) ->extension_directory('/migrations') ->get_classes(); - $classes = array_merge($classes, $classes_deprecated); - $db = new \phpbb\db\driver\sqlite(); $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); $schema_data = $schema_generator->get_schema(); From 5ce61e8c3aaa1c77a9b80596f5c899d008537ee0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Sep 2014 11:10:58 +0200 Subject: [PATCH 2/3] [ticket/12963] Remove old migration/ folder from tests PHPBB3-12963 --- .../ext/vendor2/bar/migration/migration.php | 18 ------------------ .../ext/vendor2/foo/migrations/migration.php | 18 ------------------ .../ext/vendor3/bar/migration/migration.php | 18 ------------------ tests/extension/extension_base_test.php | 12 +++--------- 4 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 tests/extension/ext/vendor2/bar/migration/migration.php delete mode 100644 tests/extension/ext/vendor2/foo/migrations/migration.php delete mode 100644 tests/extension/ext/vendor3/bar/migration/migration.php diff --git a/tests/extension/ext/vendor2/bar/migration/migration.php b/tests/extension/ext/vendor2/bar/migration/migration.php deleted file mode 100644 index fc27656d10..0000000000 --- a/tests/extension/ext/vendor2/bar/migration/migration.php +++ /dev/null @@ -1,18 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace vendor2\bar\migration; - -class migration extends \phpbb\db\migration\migration -{ -} diff --git a/tests/extension/ext/vendor2/foo/migrations/migration.php b/tests/extension/ext/vendor2/foo/migrations/migration.php deleted file mode 100644 index 63085497e3..0000000000 --- a/tests/extension/ext/vendor2/foo/migrations/migration.php +++ /dev/null @@ -1,18 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace vendor2\foo\migrations; - -class migration extends \phpbb\db\migration\migration -{ -} diff --git a/tests/extension/ext/vendor3/bar/migration/migration.php b/tests/extension/ext/vendor3/bar/migration/migration.php deleted file mode 100644 index e7280a7d5e..0000000000 --- a/tests/extension/ext/vendor3/bar/migration/migration.php +++ /dev/null @@ -1,18 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace vendor3\bar\migration; - -class migration extends \phpbb\db\migration\migration -{ -} diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php index 5535c91fc5..eee38186db 100644 --- a/tests/extension/extension_base_test.php +++ b/tests/extension/extension_base_test.php @@ -16,6 +16,9 @@ class phpbb_extension_extension_base_test extends phpbb_test_case { protected static $reflection_method_get_migration_file_list; + /** @var phpbb_mock_extension_manager */ + protected $extension_manager; + public static function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -56,18 +59,9 @@ class phpbb_extension_extension_base_test extends phpbb_test_case public function data_test_suffix_get_classes() { return array( - array( - 'vendor3/bar', - array('\vendor3\bar\migration\migration'), - ), - array( - 'vendor2/foo', - array('\vendor2\foo\migrations\migration'), - ), array( 'vendor2/bar', array( - '\vendor2\bar\migration\migration', '\vendor2\bar\migrations\migration', ), ), From 1da5c41ab354d610d1eb3d4ba5c35c557d61ede3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Sep 2014 11:07:19 +0200 Subject: [PATCH 3/3] [ticket/12963] Always use core_path and core_directory() PHPBB3-12963 --- tests/test_framework/phpbb_database_test_case.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 0eeb52443c..9dbb7150f1 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -69,8 +69,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test global $phpbb_root_path, $phpEx, $table_prefix; $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); - $classes = $finder->core_path('phpbb/') - ->core_directory('db/migration/data/') + $classes = $finder->core_path('phpbb/db/migration/data/') ->set_extensions($setup_extensions) ->extension_directory('/migrations') ->get_classes();