1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* @package Quick Title Edition Extension |
5
|
|
|
* @copyright (c) 2015 ABDev |
6
|
|
|
* @copyright (c) 2015 PastisD |
7
|
|
|
* @copyright (c) 2015 Geolim4 <http://geolim4.com> |
8
|
|
|
* @copyright (c) 2015 Zoddo <[email protected]> |
9
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
10
|
|
|
* |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace ernadoo\qte\migrations\v100; |
14
|
|
|
|
15
|
|
|
class rc4 extends \phpbb\db\migration\migration |
16
|
|
|
{ |
17
|
|
|
static public function depends_on() |
18
|
|
|
{ |
19
|
|
|
return array('\ernadoo\qte\migrations\v100\rc3'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function effectively_installed() |
23
|
|
|
{ |
24
|
|
|
return isset($this->config['qte_version']) && phpbb_version_compare($this->config['qte_version'], '1.0.0-rc4', '>='); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function update_data() |
28
|
|
|
{ |
29
|
|
|
return array( |
30
|
|
|
array('config.update', array('qte_version', '1.0.0-rc4')), |
31
|
|
|
); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function update_schema() |
35
|
|
|
{ |
36
|
|
|
return array( |
37
|
|
|
'drop_columns' => array( |
38
|
|
|
$this->table_prefix . 'topics_attr' => array( |
39
|
|
|
'allowed_forums', |
40
|
|
|
'allowed_groups', |
41
|
|
|
), |
42
|
|
|
), |
43
|
|
|
'add_columns' => array( |
44
|
|
|
$this->table_prefix . 'topics_attr' => array( |
45
|
|
|
'attr_desc' => array('VCHAR', ''), |
46
|
|
|
'attr_auths' => array('MTEXT', ''), |
47
|
|
|
), |
48
|
|
|
), |
49
|
|
|
); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function revert_schema() |
|
|
|
|
53
|
|
|
{ |
54
|
|
|
return array( |
55
|
|
|
'add_columns' => array( |
56
|
|
|
$this->table_prefix . 'topics_attr' => array( |
57
|
|
|
'allowed_forums' => array('TEXT', ''), |
58
|
|
|
'allowed_groups' => array('TEXT', ''), |
59
|
|
|
), |
60
|
|
|
), |
61
|
|
|
'drop_columns' => array( |
62
|
|
|
$this->table_prefix . 'topics_attr' => array( |
63
|
|
|
'attr_desc', |
64
|
|
|
'attr_auths', |
65
|
|
|
), |
66
|
|
|
), |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.