Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
add_storage_permission | |
0.00% |
0 / 17 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
effectively_installed | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
depends_on | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 7 |
|
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\v400; |
15 | |
16 | use phpbb\db\migration\migration; |
17 | |
18 | class add_storage_permission extends migration |
19 | { |
20 | public function effectively_installed() |
21 | { |
22 | $sql = 'SELECT auth_option_id |
23 | FROM ' . $this->tables['acl_options'] . " |
24 | WHERE auth_option = 'a_storage'"; |
25 | $result = $this->db->sql_query($sql); |
26 | $a_storage_option_id = (int) $this->db->sql_fetchfield('auth_option_id'); |
27 | $this->db->sql_freeresult($result); |
28 | |
29 | return !empty($a_storage_option_id); |
30 | } |
31 | |
32 | public static function depends_on() |
33 | { |
34 | return [ |
35 | '\phpbb\db\migration\data\v400\dev', |
36 | ]; |
37 | } |
38 | |
39 | public function update_data() |
40 | { |
41 | return [ |
42 | // Add permission |
43 | ['permission.add', ['a_storage']], |
44 | |
45 | // Set permissions |
46 | ['if', [ |
47 | ['permission.role_exists', ['ROLE_ADMIN_FULL']], |
48 | ['permission.permission_set', ['ROLE_ADMIN_FULL', 'a_storage']], |
49 | ]], |
50 | ]; |
51 | } |
52 | } |