1 | <?php |
||
12 | class c1_remove_modules extends \phpbb\db\migration\migration |
||
13 | { |
||
14 | /** |
||
15 | * This does not work when uninstalling for some reason |
||
16 | * |
||
17 | * Skip this migration if the module_dir column does not exist |
||
18 | * |
||
19 | * @return bool True to skip this migration, false to run it |
||
20 | * @access public |
||
21 | * |
||
22 | public function effectively_installed() |
||
23 | { |
||
24 | return !$this->db_tools->sql_column_exists($this->table_prefix . 'modules', 'module_dir'); |
||
25 | } |
||
26 | */ |
||
27 | |||
28 | public function update_data() |
||
29 | { |
||
30 | if (!$this->db_tools->sql_column_exists($this->table_prefix . 'modules', 'module_dir')) |
||
31 | { |
||
32 | return array(); |
||
33 | } |
||
34 | |||
35 | $sql = 'SELECT * |
||
36 | FROM ' . $this->table_prefix . "modules |
||
37 | WHERE module_dir <> '' |
||
38 | OR " . $this->db->sql_in_set('module_langname', array('CMS', 'GCP', 'GRP', 'PRO')) . ' |
||
39 | ORDER BY right_id ASC'; |
||
40 | $result = $this->db->sql_query($sql); |
||
41 | |||
42 | $migrations_ary = array(); |
||
43 | while ($row = $this->db->sql_fetchrow($result)) |
||
44 | { |
||
45 | $migrations_ary[] = array('module.remove', array($row['module_class'], $row['parent_id'], $row['module_id'])); |
||
46 | } |
||
47 | $this->db->sql_freeresult($result); |
||
48 | |||
49 | return $migrations_ary; |
||
50 | } |
||
51 | } |
||
52 |