diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-09-17 19:59:39 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-09-17 19:59:39 +0200 |
commit | 86ea314598f84bbf95f7cdc6317555f91637e918 (patch) | |
tree | 15fd80277618bd144bbf11c985e6c1488c6edf73 /phpBB/phpbb/db | |
parent | 72012381048589108b2837cbd61091c7f22b986b (diff) | |
parent | 46a9fe93d797bf7d56fd9b1e204f3c0459270122 (diff) | |
download | forums-86ea314598f84bbf95f7cdc6317555f91637e918.tar forums-86ea314598f84bbf95f7cdc6317555f91637e918.tar.gz forums-86ea314598f84bbf95f7cdc6317555f91637e918.tar.bz2 forums-86ea314598f84bbf95f7cdc6317555f91637e918.tar.xz forums-86ea314598f84bbf95f7cdc6317555f91637e918.zip |
Merge pull request #2951 from Nicofuma/ticket/13064
[ticket/13064] Validate the migrations provided to migrator::set_migrations()
* Nicofuma/ticket/13064:
[ticket/13064] Validate the migrations provided to migrator::set_migrations()
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r-- | phpBB/phpbb/db/migrator.php | 19 |
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); + } + } + } } /** |