[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 namespace phpbb\console\command\db; 14 15 use phpbb\db\output_handler\log_wrapper_migrator_output_handler; 16 use Symfony\Component\Console\Input\InputInterface; 17 use Symfony\Component\Console\Output\OutputInterface; 18 use Symfony\Component\Console\Style\SymfonyStyle; 19 20 class migrate extends \phpbb\console\command\db\migration_command 21 { 22 /** @var \phpbb\log\log */ 23 protected $log; 24 25 /** @var string phpBB root path */ 26 protected $phpbb_root_path; 27 28 /** @var \phpbb\filesystem\filesystem_interface */ 29 protected $filesystem; 30 31 /** @var \phpbb\language\language */ 32 protected $language; 33 34 public function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) 35 { 36 $this->language = $language; 37 $this->log = $log; 38 $this->filesystem = $filesystem; 39 $this->phpbb_root_path = $phpbb_root_path; 40 parent::__construct($user, $migrator, $extension_manager, $config, $cache); 41 $this->language->add_lang(array('common', 'install', 'migrator')); 42 } 43 44 protected function configure() 45 { 46 $this 47 ->setName('db:migrate') 48 ->setDescription($this->language->lang('CLI_DESCRIPTION_DB_MIGRATE')) 49 ; 50 } 51 52 protected function execute(InputInterface $input, OutputInterface $output) 53 { 54 $io = new SymfonyStyle($input, $output); 55 56 $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); 57 58 $this->migrator->create_migrations_table(); 59 60 $this->cache->purge(); 61 if ($this->config instanceof \phpbb\config\db) 62 { 63 $this->config->initialise($this->cache->get_driver()); 64 } 65 66 $this->load_migrations(); 67 $orig_version = $this->config['version']; 68 while (!$this->migrator->finished()) 69 { 70 try 71 { 72 $this->migrator->update(); 73 } 74 catch (\phpbb\db\migration\exception $e) 75 { 76 $io->error($e->getLocalisedMessage($this->user)); 77 $this->finalise_update(); 78 return 1; 79 } 80 } 81 82 if ($orig_version != $this->config['version']) 83 { 84 $this->log->add('admin', ANONYMOUS, '', 'LOG_UPDATE_DATABASE', time(), array($orig_version, $this->config['version'])); 85 } 86 87 $this->finalise_update(); 88 $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL')); 89 } 90 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |