1 | <?php |
||
17 | class v310_m1_remove_data extends \phpbb\db\migration\migration |
||
18 | { |
||
19 | /** |
||
20 | * Run migration if ABBC3_VERSION config exists |
||
21 | * |
||
22 | * @return bool |
||
23 | */ |
||
24 | public function effectively_installed() |
||
28 | |||
29 | /** |
||
30 | * This dependency is needed mostly for testing, to ensure |
||
31 | * phpBB migrations are installed before ABBC3. |
||
32 | * |
||
33 | * @return array An array of migration class names |
||
34 | */ |
||
35 | static public function depends_on() |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function update_data() |
||
64 | |||
65 | /** |
||
66 | * Remove config data from ABBC3 MOD |
||
67 | */ |
||
68 | public function remove_abbc3_configs() |
||
69 | { |
||
70 | $sql = 'DELETE FROM ' . $this->table_prefix . 'config |
||
71 | WHERE ' . $this->db->sql_like_expression('ABBC3_' . $this->db->get_any_char()); |
||
72 | $this->db->sql_query($sql); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Remove BBCodes from ABBC3 MOD |
||
77 | */ |
||
78 | public function remove_abbc3_bbcodes() |
||
79 | { |
||
80 | $abbc3_bbcode_deprecated = $this->abbc3_bbcodes(); |
||
81 | |||
82 | // Add all breaks and divisions to the array |
||
83 | $sql = 'SELECT bbcode_tag |
||
84 | FROM ' . $this->table_prefix . 'bbcodes |
||
85 | WHERE bbcode_tag ' . $this->db->sql_like_expression('break' . $this->db->get_any_char()) . ' |
||
86 | OR bbcode_tag ' . $this->db->sql_like_expression('division' . $this->db->get_any_char()); |
||
87 | |||
88 | $result = $this->db->sql_query($sql); |
||
89 | while ($row = $this->db->sql_fetchrow($result)) |
||
90 | { |
||
91 | $abbc3_bbcode_deprecated[] = $row['bbcode_tag']; |
||
92 | } |
||
93 | $this->db->sql_freeresult($result); |
||
94 | |||
95 | // Delete all the unwanted BBCodes |
||
96 | $sql = 'DELETE FROM ' . $this->table_prefix . 'bbcodes |
||
97 | WHERE ' . $this->db->sql_in_set('bbcode_tag', $abbc3_bbcode_deprecated) . ' |
||
98 | OR bbcode_id < 0'; |
||
99 | $this->db->sql_query($sql); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Array of ABBC3 MOD BBCodes to remove |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | public function abbc3_bbcodes() |
||
174 | } |
||
175 |