aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/migrator.php
diff options
context:
space:
mode:
authorMatt Friedman <maf675@gmail.com>2016-01-28 11:22:30 -0800
committerMatt Friedman <maf675@gmail.com>2016-01-28 12:17:35 -0800
commit27027deb9ce2076f64dbfdecba494efe1aa523dc (patch)
treea5c317cde6d38a42318da19a91e0fc83abbcd601 /phpBB/phpbb/db/migrator.php
parentfb1acb0ef463bc38421248497e7f0b7b271600f7 (diff)
downloadforums-27027deb9ce2076f64dbfdecba494efe1aa523dc.tar
forums-27027deb9ce2076f64dbfdecba494efe1aa523dc.tar.gz
forums-27027deb9ce2076f64dbfdecba494efe1aa523dc.tar.bz2
forums-27027deb9ce2076f64dbfdecba494efe1aa523dc.tar.xz
forums-27027deb9ce2076f64dbfdecba494efe1aa523dc.zip
[ticket/14434] Refactored to check migrations when setting them
PHPBB3-14434
Diffstat (limited to 'phpBB/phpbb/db/migrator.php')
-rw-r--r--phpBB/phpbb/db/migrator.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 8f3b860b93..a1e93942cd 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -170,10 +170,28 @@ class migrator
*/
public function set_migrations($class_names)
{
+ foreach ($class_names as $key => $class)
+ {
+ if (!self::is_migration($class))
+ {
+ unset($class_names[$key]);
+ }
+ }
+
$this->migrations = $class_names;
}
/**
+ * Get the list of available migration class names
+ *
+ * @return array Array of all migrations available to be run
+ */
+ public function get_migrations()
+ {
+ return $this->migrations;
+ }
+
+ /**
* Runs a single update step from the next migration to be applied.
*
* The update step can either be a schema or a (partial) data update. To
@@ -226,7 +244,7 @@ class migrator
*/
protected function try_apply($name)
{
- if (!self::is_migration($name))
+ if (!class_exists($name))
{
$this->output_handler->write(array('MIGRATION_NOT_VALID', $name), migrator_output_handler_interface::VERBOSITY_DEBUG);
return false;
@@ -401,7 +419,7 @@ class migrator
*/
protected function try_revert($name)
{
- if (!self::is_migration($name))
+ if (!class_exists($name))
{
return false;
}
@@ -719,7 +737,7 @@ class migrator
return false;
}
- if (!self::is_migration($name))
+ if (!class_exists($name))
{
return $name;
}