1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/14434] Refactored to check migrations when setting them

PHPBB3-14434
This commit is contained in:
Matt Friedman
2016-01-28 11:22:30 -08:00
parent fb1acb0ef4
commit 27027deb9c
6 changed files with 26 additions and 38 deletions

View File

@@ -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;
}