Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| migration_command | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| load_migrations | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| finalise_update | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 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 | abstract class migration_command extends \phpbb\console\command\command |
| 16 | { |
| 17 | /** @var \phpbb\db\migrator */ |
| 18 | protected $migrator; |
| 19 | |
| 20 | /** @var \phpbb\extension\manager */ |
| 21 | protected $extension_manager; |
| 22 | |
| 23 | /** @var \phpbb\config\config */ |
| 24 | protected $config; |
| 25 | |
| 26 | /** @var \phpbb\cache\service */ |
| 27 | protected $cache; |
| 28 | |
| 29 | public function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache) |
| 30 | { |
| 31 | $this->migrator = $migrator; |
| 32 | $this->extension_manager = $extension_manager; |
| 33 | $this->config = $config; |
| 34 | $this->cache = $cache; |
| 35 | parent::__construct($user); |
| 36 | } |
| 37 | |
| 38 | protected function load_migrations() |
| 39 | { |
| 40 | $migrations = $this->extension_manager |
| 41 | ->get_finder() |
| 42 | ->core_path('phpbb/db/migration/data/') |
| 43 | ->extension_directory('/migrations') |
| 44 | ->get_classes(); |
| 45 | |
| 46 | $this->migrator->set_migrations($migrations); |
| 47 | |
| 48 | return $this->migrator->get_migrations(); |
| 49 | } |
| 50 | |
| 51 | protected function finalise_update() |
| 52 | { |
| 53 | $this->cache->purge(); |
| 54 | $this->config->increment('assets_version', 1); |
| 55 | } |
| 56 | } |