1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/13211] Move console migrator output handler back to console folder

PHPBB3-13211
This commit is contained in:
Marc Alexander
2014-10-25 12:03:13 -07:00
parent 8443463006
commit 078e0c1e44
2 changed files with 3 additions and 2 deletions

View File

@@ -0,0 +1,69 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\db;
use phpbb\user;
use phpbb\db\migrator_output_handler_interface;
use Symfony\Component\Console\Output\OutputInterface;
class console_migrator_output_handler implements migrator_output_handler_interface
{
/**
* User object.
*
* @var user
*/
private $user;
/**
* Console output object.
*
* @var OutputInterface
*/
private $output;
/**
* Constructor
*
* @param user $user User object
* @param OutputInterface $output Console output object
*/
public function __construct(user $user, OutputInterface $output)
{
$this->user = $user;
$this->output = $output;
}
/**
* {@inheritdoc}
*/
public function write($message, $verbosity)
{
if ($verbosity <= $this->output->getVerbosity())
{
$translated_message = call_user_func_array(array($this->user, 'lang'), $message);
if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL)
{
$translated_message = '<info>' . $translated_message . '</info>';
}
else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE)
{
$translated_message = '<comment>' . $translated_message . '</comment>';
}
$this->output->writeln($translated_message);
}
}
}

View File

@@ -57,7 +57,7 @@ class migrate extends \phpbb\console\command\command
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new \phpbb\db\console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log'));
$this->migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($this->user, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log'));
$this->migrator->create_migrations_table();