Passed
Branch 1.6.0 (3e0b74)
by Sylver
05:35
created

smilecreator_1_6_0   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 20
c 1
b 0
f 0
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A depends_on() 0 3 1
A update_data() 0 27 1
1
<?php
2
3
/**
4
 * @author		Sylver35 <[email protected]>
5
 * @package		Breizh Smilie Creator Extension
6
 * @copyright	(c) 2019-2025 Sylver35  https://breizhcode.com
7
 * @license		http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
8
 */
9
10
namespace sylver35\smilecreator\migrations;
11
12
use phpbb\db\migration\migration;
13
14
class smilecreator_1_6_0 extends migration
15
{
16
	static public function depends_on()
17
	{
18
		return ['\sylver35\smilecreator\migrations\smilecreator_1_1_0'];
19
	}
20
21
	public function update_data()
22
	{
23
		return [
24
			['permission.add', ['u_creator_use', true]],
25
26
			// Groups permissions
27
			['permission.permission_set', ['ADMINISTRATORS', ['u_creator_use'], 'group']],
28
			['permission.permission_set', ['GLOBAL_MODERATORS', ['u_creator_use'], 'group']],
29
			['permission.permission_set', ['REGISTERED', ['u_creator_use'], 'group']],
30
			['permission.permission_set', ['NEWLY_REGISTERED', ['u_creator_use'], 'group']],
31
32
			// Roles permissions
33
			['if', [
34
				['permission.role_exists', ['ROLE_USER_FULL']],
35
				['permission.permission_set', ['ROLE_USER_FULL', ['u_creator_use'], 'role']],
36
			]],
37
			['if', [
38
				['permission.role_exists', ['ROLE_USER_STANDARD']],
39
				['permission.permission_set', ['ROLE_USER_STANDARD', ['u_creator_use'], 'role']],
40
			]],
41
			['if', [
42
				['permission.role_exists', ['ROLE_USER_LIMITED']],
43
				['permission.permission_set', ['ROLE_USER_LIMITED', ['u_creator_use'], 'role']],
44
			]],
45
			['if', [
46
				['permission.role_exists', ['ROLE_USER_NEW_MEMBER']],
47
				['permission.permission_set', ['ROLE_USER_NEW_MEMBER', ['u_creator_use'], 'role']],
48
			]],
49
		];
50
	}
51
}
52