Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
notifications_board | |
0.00% |
0 / 24 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
depends_on | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
update_module | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
update_user_subscriptions | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
revert_data | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
revert_user_subscriptions | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
revert_module | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\db\migration\data\v320; |
15 | |
16 | class notifications_board extends \phpbb\db\migration\migration |
17 | { |
18 | public static function depends_on() |
19 | { |
20 | return array( |
21 | '\phpbb\db\migration\data\v320\dev', |
22 | ); |
23 | } |
24 | |
25 | public function update_data() |
26 | { |
27 | return array( |
28 | array('config.add', array('allow_board_notifications', 1)), |
29 | array('custom', array(array($this, 'update_user_subscriptions'))), |
30 | array('custom', array(array($this, 'update_module'))), |
31 | ); |
32 | } |
33 | |
34 | public function update_module() |
35 | { |
36 | $sql = 'UPDATE ' . MODULES_TABLE . " |
37 | SET module_auth = 'cfg_allow_board_notifications' |
38 | WHERE module_basename = 'ucp_notifications' |
39 | AND module_mode = 'notification_list'"; |
40 | $this->sql_query($sql); |
41 | } |
42 | |
43 | public function update_user_subscriptions() |
44 | { |
45 | $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " |
46 | SET method = 'notification.method.board' |
47 | WHERE method = ''"; |
48 | $this->sql_query($sql); |
49 | } |
50 | |
51 | public function revert_data() |
52 | { |
53 | return array( |
54 | array('custom', array(array($this, 'revert_user_subscriptions'))), |
55 | array('custom', array(array($this, 'revert_module'))), |
56 | ); |
57 | } |
58 | |
59 | public function revert_user_subscriptions() |
60 | { |
61 | $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " |
62 | SET method = '' |
63 | WHERE method = 'notification.method.board'"; |
64 | $this->sql_query($sql); |
65 | } |
66 | |
67 | public function revert_module() |
68 | { |
69 | $sql = 'UPDATE ' . MODULES_TABLE . " |
70 | SET auth = '' |
71 | WHERE module_basename = 'ucp_notifications' |
72 | AND module_mode = 'notification_list'"; |
73 | $this->sql_query($sql); |
74 | } |
75 | } |