diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index 33ab868522..177ecaacbf 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -89,7 +89,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); diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php index b76f844005..a90762ec85 100755 --- a/phpBB/install/phpbbcli.php +++ b/phpBB/install/phpbbcli.php @@ -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); diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index dc9b8016b2..830ed1b2c1 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -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]); + } }