-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathversion_100.php
116 lines (107 loc) · 2.73 KB
/
version_100.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
*
* Prime Notify extension for the phpBB Forum Software package.
*
* @copyright (c) 2018 Ken F. Innes IV <https://www.absoluteanime.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace primehalo\primenotify\migrations;
use \primehalo\primenotify\core\prime_notify;
class version_100 extends \phpbb\db\migration\migration
{
/**
*
*/
public function effectively_installed()
{
return isset($this->config['primenotify_enable_post']);
}
/**
* Assign migration file dependencies for this migration
*
* @return array Array of migration files
* @static
* @access public
*/
static public function depends_on()
{
return array('\phpbb\db\migration\data\v32x\v322');
}
/**
* Add the Prime Notify columns to the users table:
* USERS_TABLE:
* user_primenotify_enable_post
* user_primenotify_enable_pm
* user_primenotify_keep_bbcodes
* user_primenotify_always_send
*
* @return array Array of table schema
* @access public
*/
public function update_schema()
{
return array(
'add_columns' => array(
USERS_TABLE => array(
'user_primenotify_enable_post' => array('BOOL', 1),
'user_primenotify_enable_pm' => array('BOOL', 1),
'user_primenotify_keep_bbcodes' => array('BOOL', 1),
'user_primenotify_always_send' => array('BOOL', 1),
),
),
);
}
/**
* Drop the Prime Notify columns from the users table
*
* @return array Array of table schema
* @access public
*/
public function revert_schema()
{
return array(
'drop_columns' => array(
USERS_TABLE => array(
'user_primenotify_enable_post',
'user_primenotify_enable_pm',
'user_primenotify_keep_bbcodes',
'user_primenotify_always_send',
),
),
);
}
/**
* Add or update data in the database
*
* @return array Array of table data
* @access public
*/
public function update_data()
{
return array(
// ACP Settings
array('config.add', array('primenotify_enable_post', prime_notify::ENABLED)),
array('config.add', array('primenotify_enable_pm', prime_notify::ENABLED)),
array('config.add', array('primenotify_keep_bbcodes', prime_notify::ENABLED)),
array('config.add', array('primenotify_always_send', prime_notify::ENABLED)),
array('config.add', array('primenotify_truncate', 0)),
// Add a parent module (ACP_PRIMENOTIFY_TITLE) to the Extensions tab (ACP_CAT_DOT_MODS)
array('module.add', array(
'acp',
'ACP_CAT_DOT_MODS',
'ACP_PRIMENOTIFY_TITLE'
)),
// Add our main_module to the parent module (ACP_PRIMENOTIFY_TITLE)
array('module.add', array(
'acp',
'ACP_PRIMENOTIFY_TITLE',
array(
'module_basename' => '\primehalo\primenotify\acp\main_module',
'modes' => array('settings'),
),
)),
);
}
}