mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 06:38:43 +01:00
[ticket/16417] Fix CLI database migration for phpBB 3.0.x
PHPBB3-16417
This commit is contained in:
parent
d7435d02d3
commit
4926ff0992
@ -84,7 +84,7 @@ $user = $phpbb_container->get('user');
|
||||
$user->data['user_id'] = ANONYMOUS;
|
||||
$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->register_container_commands($phpbb_container->get('console.command_collection'));
|
||||
$application->run($input);
|
||||
|
@ -42,11 +42,14 @@ $phpbb_installer_container->get('request')->enable_super_globals();
|
||||
/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */
|
||||
$phpbb_filesystem = $phpbb_installer_container->get('filesystem');
|
||||
|
||||
/** @var \phpbb\config\config $config */
|
||||
$config = $phpbb_installer_container->get('config');
|
||||
|
||||
/** @var \phpbb\language\language $language */
|
||||
$language = $phpbb_installer_container->get('language');
|
||||
$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->register_container_commands($phpbb_installer_container->get('console.installer.command_collection'));
|
||||
$application->run($input);
|
||||
|
@ -27,7 +27,12 @@ class application extends \Symfony\Component\Console\Application
|
||||
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;
|
||||
|
||||
@ -35,10 +40,12 @@ class application extends \Symfony\Component\Console\Application
|
||||
* @param string $name The name 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\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->config = $config;
|
||||
|
||||
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)
|
||||
{
|
||||
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…
x
Reference in New Issue
Block a user