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() |
||
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() |
||
134 | |||
135 | /** |
||
136 | * Array of ABBC3 MOD BBCodes to remove |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function abbc3_bbcodes() |
||
230 | } |
||
231 |