aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-09-17 19:59:47 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-09-17 19:59:47 +0200
commitbf6ecccd250d4f1247c895153c7604826610dc72 (patch)
treef341c4470955fcc0548c4f0b7bf50cf22e06fdf2 /phpBB/phpbb
parent428e4925429e29670fe08634a8d05c2f08220e43 (diff)
parent86ea314598f84bbf95f7cdc6317555f91637e918 (diff)
downloadforums-bf6ecccd250d4f1247c895153c7604826610dc72.tar
forums-bf6ecccd250d4f1247c895153c7604826610dc72.tar.gz
forums-bf6ecccd250d4f1247c895153c7604826610dc72.tar.bz2
forums-bf6ecccd250d4f1247c895153c7604826610dc72.tar.xz
forums-bf6ecccd250d4f1247c895153c7604826610dc72.zip
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/13064] Validate the migrations provided to migrator::set_migrations()
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/db/migrator.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 44bea3c5d2..43393a8935 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -129,11 +129,28 @@ class migrator
* Sets the list of available migration class names to the given array.
*
* @param array $class_names An array of migration class names
+ * @param bool $check_fulfillable If TRUE (default), we will check
+ * if all of the migrations are fulfillable after loading them.
+ * If FALSE, we will not check. You SHOULD check at least once
+ * to prevent errors.
* @return null
+ * @throws \phpbb\db\migration\exception
*/
- public function set_migrations($class_names)
+ public function set_migrations($class_names, $check_fulfillable = true)
{
$this->migrations = $class_names;
+
+ if ($check_fulfillable)
+ {
+ foreach ($this->migrations as $name)
+ {
+ $unfulfillable = $this->unfulfillable($name);
+ if ($unfulfillable !== false)
+ {
+ throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
+ }
+ }
+ }
}
/**