1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* Advanced BBCode Box |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2013 Matt Friedman |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace vse\abbc3\migrations; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This migration removes old data from 3.0 |
15
|
|
|
* installations of Advanced BBCode Box 3 MOD. |
16
|
|
|
*/ |
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() |
25
|
|
|
{ |
26
|
|
|
return !isset($this->config['ABBC3_VERSION']); |
27
|
|
|
} |
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() |
36
|
|
|
{ |
37
|
|
|
return array('\phpbb\db\migration\data\v310\beta4'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
*/ |
43
|
|
|
public function update_data() |
44
|
|
|
{ |
45
|
|
|
return array( |
46
|
|
|
array('if', array( |
47
|
|
|
array('module.exists', array('acp', false, 'ACP_ABBC3_BBCODES')), |
48
|
|
|
array('module.remove', array('acp', false, 'ACP_ABBC3_BBCODES')), |
49
|
|
|
)), |
50
|
|
|
array('if', array( |
51
|
|
|
array('module.exists', array('acp', false, 'ACP_ABBC3_SETTINGS')), |
52
|
|
|
array('module.remove', array('acp', false, 'ACP_ABBC3_SETTINGS')), |
53
|
|
|
)), |
54
|
|
|
array('if', array( |
55
|
|
|
array('module.exists', array('acp', false, 'ACP_ABBCODES')), |
56
|
|
|
array('module.remove', array('acp', false, 'ACP_ABBCODES')), |
57
|
|
|
)), |
58
|
|
|
|
59
|
|
|
// Custom functions |
60
|
|
|
array('custom', array(array($this, 'remove_abbc3_configs'))), |
61
|
|
|
array('custom', array(array($this, 'remove_abbc3_bbcodes'))), |
62
|
|
|
); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Remove config data from ABBC3 MOD |
67
|
|
|
*/ |
68
|
|
|
public function remove_abbc3_configs() |
69
|
|
|
{ |
70
|
|
|
$abbc3_config_names = array( |
71
|
|
|
'ABBC3_VERSION', |
72
|
|
|
'ABBC3_MOD', |
73
|
|
|
'ABBC3_BG', |
74
|
|
|
'ABBC3_TAB', |
75
|
|
|
'ABBC3_BOXRESIZE', |
76
|
|
|
'ABBC3_RESIZE', |
77
|
|
|
'ABBC3_RESIZE_METHOD', |
78
|
|
|
'ABBC3_RESIZE_BAR', |
79
|
|
|
'ABBC3_MAX_IMG_WIDTH', |
80
|
|
|
'ABBC3_MAX_IMG_HEIGHT', |
81
|
|
|
'ABBC3_RESIZE_SIGNATURE', |
82
|
|
|
'ABBC3_MAX_SIG_WIDTH', |
83
|
|
|
'ABBC3_MAX_SIG_HEIGHT', |
84
|
|
|
'ABBC3_MAX_THUM_WIDTH', |
85
|
|
|
'ABBC3_COLOR_MODE', |
86
|
|
|
'ABBC3_HIGHLIGHT_MODE', |
87
|
|
|
'ABBC3_WIZARD_MODE', |
88
|
|
|
'ABBC3_WIZARD_width', |
89
|
|
|
'ABBC3_WIZARD_height', |
90
|
|
|
'ABBC3_VIDEO_width', |
91
|
|
|
'ABBC3_VIDEO_height', |
92
|
|
|
'ABBC3_VIDEO_OPTIONS', |
93
|
|
|
'ABBC3_VIDEO_WMODE', |
94
|
|
|
'ABBC3_UCP_MODE', |
95
|
|
|
'ABBC3_PATH', |
96
|
|
|
'ABBC3_GREYBOX', |
97
|
|
|
'ABBC3_JAVASCRIPT', |
98
|
|
|
'ABBC3_UPLOAD_MAX_SIZE', |
99
|
|
|
'ABBC3_UPLOAD_EXTENSION', |
100
|
|
|
); |
101
|
|
|
|
102
|
|
|
// Delete all the unwanted ABBC3 configs |
103
|
|
|
$sql = 'DELETE FROM ' . $this->table_prefix . 'config |
104
|
|
|
WHERE ' . $this->db->sql_in_set('config_name', $abbc3_config_names); |
105
|
|
|
$this->db->sql_query($sql); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Remove BBCodes from ABBC3 MOD |
110
|
|
|
*/ |
111
|
|
|
public function remove_abbc3_bbcodes() |
112
|
|
|
{ |
113
|
|
|
$abbc3_bbcode_deprecated = $this->abbc3_bbcodes(); |
114
|
|
|
|
115
|
|
|
// Add all breaks and divisions to the array |
116
|
|
|
$sql = 'SELECT bbcode_tag |
117
|
|
|
FROM ' . $this->table_prefix . 'bbcodes |
118
|
|
|
WHERE bbcode_tag ' . $this->db->sql_like_expression('break' . $this->db->get_any_char()) . ' |
119
|
|
|
OR bbcode_tag ' . $this->db->sql_like_expression('division' . $this->db->get_any_char()); |
120
|
|
|
|
121
|
|
|
$result = $this->db->sql_query($sql); |
122
|
|
|
while ($row = $this->db->sql_fetchrow($result)) |
123
|
|
|
{ |
124
|
|
|
$abbc3_bbcode_deprecated[] = $row['bbcode_tag']; |
125
|
|
|
} |
126
|
|
|
$this->db->sql_freeresult($result); |
127
|
|
|
|
128
|
|
|
// Delete all the unwanted BBCodes |
129
|
|
|
$sql = 'DELETE FROM ' . $this->table_prefix . 'bbcodes |
130
|
|
|
WHERE ' . $this->db->sql_in_set('bbcode_tag', $abbc3_bbcode_deprecated) . ' |
131
|
|
|
OR bbcode_id < 0'; |
132
|
|
|
$this->db->sql_query($sql); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Array of ABBC3 MOD BBCodes to remove |
137
|
|
|
* |
138
|
|
|
* @return array |
139
|
|
|
*/ |
140
|
|
|
public function abbc3_bbcodes() |
141
|
|
|
{ |
142
|
|
|
return array( |
143
|
|
|
// These exists in core |
144
|
|
|
'b', |
145
|
|
|
'code', |
146
|
|
|
'color', |
147
|
|
|
'email', |
148
|
|
|
'flash', |
149
|
|
|
'i', |
150
|
|
|
'img=', |
151
|
|
|
'listb', |
152
|
|
|
'listitem', |
153
|
|
|
'listo', |
154
|
|
|
'quote', |
155
|
|
|
'size', |
156
|
|
|
'u', |
157
|
|
|
'url', |
158
|
|
|
'url=', |
159
|
|
|
|
160
|
|
|
// These were not really BBCodes |
161
|
|
|
'copy', |
162
|
|
|
'cut', |
163
|
|
|
'grad', |
164
|
|
|
'paste', |
165
|
|
|
'plain', |
166
|
|
|
'imgshack', |
167
|
|
|
|
168
|
|
|
// These are deprecated |
169
|
|
|
'click', // click_pass |
170
|
|
|
'ed2k', |
171
|
|
|
'flv', // auto_embed_video |
172
|
|
|
'quicktime', |
173
|
|
|
'ram', |
174
|
|
|
'rapidshare', // rapidshare_pass |
175
|
|
|
'stream', |
176
|
|
|
'testlink', // testlink_pass |
177
|
|
|
'video', |
178
|
|
|
'wave=', // Text_effect_pass |
179
|
|
|
'web', |
180
|
|
|
'scrippet', // scrippets_pass |
181
|
|
|
'search', // search_pass |
182
|
|
|
'thumbnail', // thumb_pass |
183
|
|
|
'hr', // no closing |
184
|
|
|
'tab=', // no closing |
185
|
|
|
'tabs', // simpleTabs_pass |
186
|
|
|
'table=', // table_pass |
187
|
|
|
'anchor=', // anchor_pass |
188
|
|
|
'upload', |
189
|
|
|
'html', |
190
|
|
|
'collegehumor', // auto_embed_video |
191
|
|
|
'dm', // auto_embed_video |
192
|
|
|
'gamespot', // auto_embed_video |
193
|
|
|
'ignvideo', // auto_embed_video |
194
|
|
|
'liveleak', // auto_embed_video |
195
|
|
|
'veoh', // auto_embed_video |
196
|
|
|
|
197
|
|
|
// These are being replaced by new BBCodes |
198
|
|
|
'align=justify', // replaced by align= |
199
|
|
|
'align=left', // replaced by align= |
200
|
|
|
'align=right', // replaced by align= |
201
|
|
|
'dir=rtl', // replaced by dir= |
202
|
|
|
'marq=down', // replaced by marq= |
203
|
|
|
'marq=left', // replaced by marq= |
204
|
|
|
'marq=right', // replaced by marq= |
205
|
|
|
|
206
|
|
|
// These will be updated in another migration |
207
|
|
|
// 'align=center', // replaced by align= |
208
|
|
|
// 'blur=', // Text_effect_pass |
209
|
|
|
// 'dir=ltr', // replaced by dir= |
210
|
|
|
// 'dropshadow=', // Text_effect_pass |
211
|
|
|
// 'fade', |
212
|
|
|
// 'font=', |
213
|
|
|
// 'glow=', // Text_effect_pass |
214
|
|
|
// 'highlight=', |
215
|
|
|
// 'marq=up', // replaced by marq= |
216
|
|
|
// 'mod=', // mod_pass |
217
|
|
|
// 'nfo', // nfo_pass |
218
|
|
|
// 'offtopic', // offtopic_pass |
219
|
|
|
// 'pre', |
220
|
|
|
// 's', |
221
|
|
|
// 'shadow=', // Text_effect_pass |
222
|
|
|
// 'spoil', // spoil_pass |
223
|
|
|
// 'sub', |
224
|
|
|
// 'sup', |
225
|
|
|
// 'youtube', // BBvideo_pass |
226
|
|
|
// 'BBvideo', // BBvideo_pass |
227
|
|
|
// 'hidden', // hidden_pass |
228
|
|
|
); |
229
|
|
|
} |
230
|
|
|
} |
231
|
|
|
|