aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php27
-rw-r--r--phpBB/phpbb/db/migrator.php20
-rw-r--r--phpBB/phpbb/extension/manager.php7
3 files changed, 27 insertions, 27 deletions
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index 29f0fe7c16..dc16ed0699 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -32,21 +32,13 @@ class migrate extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\db\tools */
- protected $db_tools;
-
- /** @var string */
- protected $table_prefix;
-
- function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\db\tools $db_tools, $table_prefix)
+ function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log)
{
$this->migrator = $migrator;
$this->extension_manager = $extension_manager;
$this->config = $config;
$this->cache = $cache;
$this->log = $log;
- $this->db_tools = $db_tools;
- $this->table_prefix = $table_prefix;
parent::__construct($user);
$this->user->add_lang(array('common', 'install', 'migrator'));
}
@@ -61,22 +53,7 @@ class migrate extends \phpbb\console\command\command
protected function execute(InputInterface $input, OutputInterface $output)
{
- // Make sure migrations have been installed.
- if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations'))
- {
- $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array(
- 'COLUMNS' => array(
- 'migration_name' => array('VCHAR', ''),
- 'migration_depends_on' => array('TEXT', ''),
- 'migration_schema_done' => array('BOOL', 0),
- 'migration_data_done' => array('BOOL', 0),
- 'migration_data_state' => array('TEXT', ''),
- 'migration_start_time' => array('TIMESTAMP', 0),
- 'migration_end_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'migration_name',
- ));
- }
+ $this->migrator->create_migrations_table();
$this->load_migrations();
$orig_version = $this->config['version'];
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 8b089a060f..4b1ab1fd32 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -767,4 +767,24 @@ class migrator
return $this->migrations;
}
+
+ public function create_migrations_table()
+ {
+ // Make sure migrations have been installed.
+ if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations'))
+ {
+ $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array(
+ 'COLUMNS' => array(
+ 'migration_name' => array('VCHAR', ''),
+ 'migration_depends_on' => array('TEXT', ''),
+ 'migration_schema_done' => array('BOOL', 0),
+ 'migration_data_done' => array('BOOL', 0),
+ 'migration_data_state' => array('TEXT', ''),
+ 'migration_start_time' => array('TIMESTAMP', 0),
+ 'migration_end_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'migration_name',
+ ));
+ }
+ }
}
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 98b2654980..4a12e9ec8c 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -78,8 +78,11 @@ class manager
$this->extensions = array();
// Do not try to load any extensions if the extension table
- // does not exist. (The table is crated by the firsts migrations).
- if (version_compare($this->config['version'], '3.1.0-dev', '<'))
+ // does not exist or when installing or updating.
+ // Note: database updater invokes this code, and in 3.0
+ // there is no extension table therefore the rest of this function
+ // fails
+ if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<'))
{
return;
}