|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* Advanced BBCode Box |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2015 Matt Friedman |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace vse\abbc3\migrations; |
|
12
|
|
|
|
|
13
|
|
|
use \phpbb\db\migration\container_aware_migration; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class wrapper for installing/updating bbcodes in migrations. |
|
17
|
|
|
* This class must be kept outside of the migrations directory |
|
18
|
|
|
* since this is not a migration file. It's just a wrapper that |
|
19
|
|
|
* can be extended by multiple migration files. |
|
20
|
|
|
*/ |
|
21
|
|
|
abstract class bbcodes_migration_base extends container_aware_migration |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* @var array An array of bbcodes data to install |
|
25
|
|
|
*/ |
|
26
|
|
|
protected static $bbcode_data; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Get the bbcodes installer object |
|
30
|
|
|
* |
|
31
|
|
|
* @return \vse\abbc3\core\bbcodes_installer |
|
32
|
|
|
*/ |
|
33
|
|
|
public function get_bbcodes_installer() |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var \phpbb\group\helper $group_helper */ |
|
36
|
|
|
$group_helper = $this->container->get('group_helper'); |
|
37
|
|
|
|
|
38
|
|
|
/** @var \phpbb\language\language $language */ |
|
39
|
|
|
$language = $this->container->get('language'); |
|
40
|
|
|
|
|
41
|
|
|
/** @var \phpbb\request\request $request */ |
|
42
|
|
|
$request = $this->container->get('request'); |
|
43
|
|
|
|
|
44
|
|
|
return new \vse\abbc3\core\bbcodes_installer($this->db, $group_helper, $language, $request, $this->phpbb_root_path, $this->php_ext); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Wrapper for installing bbcodes in migrations |
|
49
|
|
|
*/ |
|
50
|
|
|
public function install_abbc3_bbcodes() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->get_bbcodes_installer()->install_bbcodes(static::$bbcode_data); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Wrapper for deleting bbcodes in migrations |
|
57
|
|
|
*/ |
|
58
|
|
|
public function delete_abbc3_bbcodes() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->get_bbcodes_installer()->delete_bbcodes(static::$bbcode_data); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|