Completed
Push — master ( 03c5d4...7f0f9f )
by
unknown
01:43 queued 11s
created

m12_set_permissions   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A depends_on() 0 8 1
A effectively_installed() 0 4 1
A update_data() 0 6 1
A update_permissions() 0 5 1
1
<?php
2
/**
3
 *
4
 * Ideas extension for 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
 */
10
11
namespace phpbb\ideas\migrations;
12
13
class m12_set_permissions extends \phpbb\db\migration\migration
14
{
15
	/**
16
	 * {@inheritDoc}
17
	 */
18
	public static function depends_on()
19
	{
20
		return [
21
			'\phpbb\ideas\migrations\m1_initial_schema',
22
			'\phpbb\ideas\migrations\m3_acp_data',
23
			'\phpbb\ideas\migrations\m11_reparse_old_ideas',
24
		];
25
	}
26
27
	/**
28
	 * {@inheritDoc}
29
	 */
30
	public function effectively_installed()
31
	{
32
		return $this->config['ideas_forum_id'] === 0;
33
	}
34
35
	/**
36
	 * @inheritDoc
37
	 */
38
	public function update_data()
39
	{
40
		return [
41
			['custom', [[$this, 'update_permissions']]],
42
		];
43
	}
44
45
	public function update_permissions()
46
	{
47
		$permission_helper = new \phpbb\ideas\factory\permission_helper($this->config, $this->db, $this->phpbb_root_path, $this->php_ext);
48
		$permission_helper->set_ideas_forum_permissions($this->config['ideas_forum_id']);
49
	}
50
}
51