mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
Merge pull request #5926 from rxu/ticket/16417
[ticket/16417] Fix CLI database migration for phpBB 3.0.x
This commit is contained in:
commit
f9d4e11a27
3 changed files with 24 additions and 6 deletions
|
@ -84,7 +84,7 @@ $user = $phpbb_container->get('user');
|
||||||
$user->data['user_id'] = ANONYMOUS;
|
$user->data['user_id'] = ANONYMOUS;
|
||||||
$user->ip = '127.0.0.1';
|
$user->ip = '127.0.0.1';
|
||||||
|
|
||||||
$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $language);
|
$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $language, $config);
|
||||||
$application->setDispatcher($phpbb_container->get('dispatcher'));
|
$application->setDispatcher($phpbb_container->get('dispatcher'));
|
||||||
$application->register_container_commands($phpbb_container->get('console.command_collection'));
|
$application->register_container_commands($phpbb_container->get('console.command_collection'));
|
||||||
$application->run($input);
|
$application->run($input);
|
||||||
|
|
|
@ -42,11 +42,14 @@ $phpbb_installer_container->get('request')->enable_super_globals();
|
||||||
/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */
|
/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */
|
||||||
$phpbb_filesystem = $phpbb_installer_container->get('filesystem');
|
$phpbb_filesystem = $phpbb_installer_container->get('filesystem');
|
||||||
|
|
||||||
|
/** @var \phpbb\config\config $config */
|
||||||
|
$config = $phpbb_installer_container->get('config');
|
||||||
|
|
||||||
/** @var \phpbb\language\language $language */
|
/** @var \phpbb\language\language $language */
|
||||||
$language = $phpbb_installer_container->get('language');
|
$language = $phpbb_installer_container->get('language');
|
||||||
$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting', 'cli'));
|
$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting', 'cli'));
|
||||||
|
|
||||||
$application = new \phpbb\console\application('phpBB Installer', PHPBB_VERSION, $language);
|
$application = new \phpbb\console\application('phpBB Installer', PHPBB_VERSION, $language, $config);
|
||||||
$application->setDispatcher($phpbb_installer_container->get('dispatcher'));
|
$application->setDispatcher($phpbb_installer_container->get('dispatcher'));
|
||||||
$application->register_container_commands($phpbb_installer_container->get('console.installer.command_collection'));
|
$application->register_container_commands($phpbb_installer_container->get('console.installer.command_collection'));
|
||||||
$application->run($input);
|
$application->run($input);
|
||||||
|
|
|
@ -27,7 +27,12 @@ class application extends \Symfony\Component\Console\Application
|
||||||
protected $in_shell = false;
|
protected $in_shell = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \phpbb\language\language User object
|
* @var \phpbb\config\config Config object
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \phpbb\language\language Language object
|
||||||
*/
|
*/
|
||||||
protected $language;
|
protected $language;
|
||||||
|
|
||||||
|
@ -35,10 +40,12 @@ class application extends \Symfony\Component\Console\Application
|
||||||
* @param string $name The name of the application
|
* @param string $name The name of the application
|
||||||
* @param string $version The version of the application
|
* @param string $version The version of the application
|
||||||
* @param \phpbb\language\language $language The user which runs the application (used for translation)
|
* @param \phpbb\language\language $language The user which runs the application (used for translation)
|
||||||
|
* @param \phpbb\config\config $config Config object
|
||||||
*/
|
*/
|
||||||
public function __construct($name, $version, \phpbb\language\language $language)
|
public function __construct($name, $version, \phpbb\language\language $language, \phpbb\config\config $config)
|
||||||
{
|
{
|
||||||
$this->language = $language;
|
$this->language = $language;
|
||||||
|
$this->config = $config;
|
||||||
|
|
||||||
parent::__construct($name, $version);
|
parent::__construct($name, $version);
|
||||||
}
|
}
|
||||||
|
@ -97,9 +104,17 @@ class application extends \Symfony\Component\Console\Application
|
||||||
*/
|
*/
|
||||||
public function register_container_commands(\phpbb\di\service_collection $command_collection)
|
public function register_container_commands(\phpbb\di\service_collection $command_collection)
|
||||||
{
|
{
|
||||||
foreach ($command_collection as $service_command)
|
$commands_list = array_keys($command_collection->getArrayCopy());
|
||||||
|
foreach ($commands_list as $service_command)
|
||||||
{
|
{
|
||||||
$this->add($service_command);
|
// config_text DB table does not exist in phpBB prior to 3.1
|
||||||
|
// Hence skip cron tasks as they include reparser cron as it uses config_text table
|
||||||
|
if (phpbb_version_compare($this->config['version'], '3.1.0', '<') && strpos($service_command, 'cron') !== false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->add($command_collection[$service_command]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue