aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-09-14 00:32:34 +0200
committerTristan Darricau <github@nicofuma.fr>2014-09-14 00:56:41 +0200
commit46a9fe93d797bf7d56fd9b1e204f3c0459270122 (patch)
tree416b40259b6b71dbaf5037a6093caa5635694732 /phpBB
parent48dbef391b4b1b9be219750c8a57850207d98034 (diff)
downloadforums-46a9fe93d797bf7d56fd9b1e204f3c0459270122.tar
forums-46a9fe93d797bf7d56fd9b1e204f3c0459270122.tar.gz
forums-46a9fe93d797bf7d56fd9b1e204f3c0459270122.tar.bz2
forums-46a9fe93d797bf7d56fd9b1e204f3c0459270122.tar.xz
forums-46a9fe93d797bf7d56fd9b1e204f3c0459270122.zip
[ticket/13064] Validate the migrations provided to migrator::set_migrations()
PHPBB3-13064
Diffstat (limited to '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);
+ }
+ }
+ }
}
/**