From 27027deb9ce2076f64dbfdecba494efe1aa523dc Mon Sep 17 00:00:00 2001 From: Matt Friedman <maf675@gmail.com> Date: Thu, 28 Jan 2016 11:22:30 -0800 Subject: [ticket/14434] Refactored to check migrations when setting them PHPBB3-14434 --- phpBB/phpbb/db/migrator.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/db') 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,9 +170,27 @@ 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. * @@ -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; } -- cgit v1.2.1