aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/migrator.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/db/migrator.php')
-rw-r--r--phpBB/phpbb/db/migrator.php40
1 files changed, 21 insertions, 19 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index ca3ffc8043..0b9463a622 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db;
+
/**
* @ignore
*/
@@ -16,19 +18,19 @@ if (!defined('IN_PHPBB'))
}
/**
-* The migrator is responsible for applying new migrations in the correct order.
+* The migrator is responsible for applying new \migrations in the correct order.
*
* @package db
*/
-class phpbb_db_migrator
+class migrator
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_db_tools */
+ /** @var \phpbb\db\tools */
protected $db_tools;
/** @var string */
@@ -71,7 +73,7 @@ class phpbb_db_migrator
/**
* Constructor of the database migrator
*/
- public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
+ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
{
$this->config = $config;
$this->db = $db;
@@ -240,7 +242,7 @@ class phpbb_db_migrator
$state['migration_data_done'] = ($result === true);
$state['migration_end_time'] = ($result === true) ? time() : 0;
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// Revert the schema changes
$this->revert($name);
@@ -398,7 +400,7 @@ class phpbb_db_migrator
));
}
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// We should try rolling back here
foreach ($steps as $reverse_step_identifier => $reverse_step)
@@ -474,12 +476,12 @@ class phpbb_db_migrator
case 'if':
if (!isset($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
}
if (!isset($parameters[1]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
}
$condition = $parameters[0];
@@ -496,7 +498,7 @@ class phpbb_db_migrator
case 'custom':
if (!is_callable($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
}
return array(
@@ -508,17 +510,17 @@ class phpbb_db_migrator
default:
if (!$method)
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
}
if (!isset($this->tools[$class]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
}
if (!method_exists(get_class($this->tools[$class]), $method))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
}
// Attempt to reverse operations
@@ -656,7 +658,7 @@ class phpbb_db_migrator
* Helper to get a migration
*
* @param string $name Name of the migration
- * @return phpbb_db_migration
+ * @return \phpbb\db\migration\migration
*/
protected function get_migration($name)
{
@@ -694,7 +696,7 @@ class phpbb_db_migrator
/**
* Load migration data files from a directory
*
- * @param phpbb_extension_finder $finder
+ * @param \phpbb\extension\finder $finder
* @param string $path Path to migration data files
* @param bool $check_fulfillable If TRUE (default), we will check
* if all of the migrations are fulfillable after loading them.
@@ -703,11 +705,11 @@ class phpbb_db_migrator
* with the last call to prevent throwing errors unnecessarily).
* @return array Array of migration names
*/
- public function load_migrations(phpbb_extension_finder $finder, $path, $check_fulfillable = true)
+ public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true)
{
if (!is_dir($path))
{
- throw new phpbb_db_migration_exception('DIRECTORY INVALID', $path);
+ throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path);
}
$migrations = array();
@@ -736,7 +738,7 @@ class phpbb_db_migrator
$unfulfillable = $this->unfulfillable($name);
if ($unfulfillable !== false)
{
- throw new phpbb_db_migration_exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
+ throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
}
}
}