Completed
Push — master ( 8995ac...f2dc1d )
by Matt
03:30 queued 02:11
created

permissions::effectively_installed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * Topic Image Preview. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2020, Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\topicimagepreview\migrations;
12
13
class permissions extends \phpbb\db\migration\migration
14
{
15
	/**
16
	 * @inheritdoc
17
	 */
18
	public function effectively_installed()
19
	{
20
		return $this->config->offsetExists('vse_tip_srt');
21
	}
22
23
	/**
24
	 * @inheritdoc
25
	 */
26
	public static function depends_on()
27
	{
28
		return ['\vse\topicimagepreview\migrations\install_tip'];
29
	}
30
31
	/**
32
	 * @inheritdoc
33
	 */
34
	public function update_data()
35
	{
36
		return [
37
			// Add new configs
38
			['config.add', ['vse_tip_srt', 1]],
39
			['config.add', ['vse_tip_pst', 1]],
40
41
			// Add permission
42
			['permission.add', ['f_vse_tip', false, 'f_list_topics']],
43
44
			// Unset permissions that may have been set by copying from f_list_topics
45
			['permission.permission_unset', ['ROLE_FORUM_BOT', 'f_vse_tip']],
46
			['permission.permission_unset', ['ROLE_FORUM_ONQUEUE', 'f_vse_tip']],
47
		];
48
	}
49
}
50