aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-01-15 18:31:27 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-01-15 18:31:27 +0100
commit0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c (patch)
treead10421473d02d20de29d04a4a2d33f797acf271 /phpBB
parent8e584dfa6b139fb415e6c18e5daf8fe8f323a5ce (diff)
parent9dc1729e379691c97b319a12912dc48ad779a286 (diff)
downloadforums-0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c.tar
forums-0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c.tar.gz
forums-0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c.tar.bz2
forums-0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c.tar.xz
forums-0178c27092762cf2ca8bf355e6f7e6eaf5cf0c3c.zip
Merge pull request #3626 from imkingdavid/ticket/13733
[ticket/13733] Allow non-migration files inside migrations folder
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/extension/base.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index 5bb530bad4..40bd349c4d 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -121,9 +121,11 @@ class base implements \phpbb\extension\extension_interface
/**
* Get the list of migration files from this extension
*
+ * @var bool $validate_classes Whether or not to check that the migration
+ * class exists and extends the base migration class.
* @return array
*/
- protected function get_migration_file_list()
+ protected function get_migration_file_list($validate_classes = true)
{
if ($this->migrations !== false)
{
@@ -137,6 +139,30 @@ class base implements \phpbb\extension\extension_interface
$migrations = $this->extension_finder->get_classes_from_files($migrations);
+ if ($validate_classes)
+ {
+ foreach ($migrations as $key => $migration)
+ {
+ // If the class exists and is a subclass of the
+ // \phpbb\db\migration\migration abstract class
+ // we skip it.
+
+ // Otherwise, i.e. if it doesn't exist or it is
+ // not an extend the abstract class, we unset it
+ if (class_exists($migration))
+ {
+ $reflector = new \ReflectionClass($migration);
+ if ($reflector->isSubclassOf('\phpbb\db\migration\migration') && $reflector->isInstantiable())
+ {
+ continue;
+ }
+
+ }
+
+ unset($migrations[$key]);
+ }
+ }
+
return $migrations;
}
}