From ff872a79707200ed7e3e7c25b4ebc7f6f4313b6c Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 10 Sep 2014 19:17:37 +0200 Subject: [ticket/12963] Don't use static var in \extension\base\get_migration_file_list The static var was global to all instance of \phpbb\base and so if two different instances (for two different extensions) were created by the same script they shared the same migrations list. PHPBB3-12963 --- phpBB/phpbb/extension/base.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index 288fb7d19c..e0ccb4c65b 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -35,6 +35,9 @@ class base implements \phpbb\extension\extension_interface /** @var string */ protected $extension_path; + /** @var string[] */ + private $migrations = false; + /** * Constructor * @@ -122,11 +125,9 @@ class base implements \phpbb\extension\extension_interface */ protected function get_migration_file_list() { - static $migrations = false; - - if ($migrations !== false) + if ($this->migrations !== false) { - return $migrations; + return $this->migrations; } // Only have the finder search in this extension path directory -- cgit v1.2.1 From 72ee4b3a7c4fca67cb226dab3ed27a8afa903144 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 10 Sep 2014 12:08:13 +0200 Subject: [ticket/12963] Load extensions migrations from /migration PHPBB3-12963 --- phpBB/phpbb/console/command/db/migrate.php | 9 +++++++++ phpBB/phpbb/extension/base.php | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index c3caae5f70..a25886fb82 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -117,8 +117,17 @@ 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 to be removed in 3.2 final + $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 e0ccb4c65b..9cd37ec8b2 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -132,10 +132,20 @@ class base implements \phpbb\extension\extension_interface // Only have the finder search in this extension path directory $migrations = $this->extension_finder - ->extension_directory('/migrations') + ->extension_directory('/migration') ->find_from_extension($this->extension_name, $this->extension_path); + $migrations = $this->extension_finder->get_classes_from_files($migrations); + // @deprecated to be removed in 3.2 final + $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; } } -- cgit v1.2.1 From 8b16d3141396a11db3ab4ade49af91f2477f5fb6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 16 Sep 2014 20:18:10 +0200 Subject: [ticket/12963] Edit deprecation message PHPBB3-12963 --- phpBB/phpbb/console/command/db/migrate.php | 2 +- phpBB/phpbb/extension/base.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index a25886fb82..68638a9515 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -120,7 +120,7 @@ class migrate extends \phpbb\console\command\command ->extension_directory('/migration') ->get_classes(); - // @deprecated to be removed in 3.2 final + // @deprecated 3.1.0-RC4 (To be removed: 3.2.0) $migrations_deprecated = $this->extension_manager ->get_finder() ->extension_directory('/migrations') diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index 9cd37ec8b2..b74026e6ab 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -137,7 +137,7 @@ class base implements \phpbb\extension\extension_interface $migrations = $this->extension_finder->get_classes_from_files($migrations); - // @deprecated to be removed in 3.2 final + // @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); -- cgit v1.2.1