Completed
Push — master ( 56db4e...d7c302 )
by Michael
8s
created

install_module::update_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * Topic Prefixes extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2016 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\topicprefixes\migrations;
12
13
/**
14
 * Class install_module
15
 */
16
class install_module extends \phpbb\db\migration\migration
17
{
18
	/**
19
	 * @inheritdoc
20
	 */
21
	public function effectively_installed()
22
	{
23
		$sql = 'SELECT module_id
24
			FROM ' . $this->table_prefix . "modules
25
			WHERE module_class = 'acp'
26
				AND module_langname = 'ACP_MANAGE_PREFIXES'";
27
		$result = $this->db->sql_query($sql);
28
		$module_id = $this->db->sql_fetchfield('module_id');
29
		$this->db->sql_freeresult($result);
30
31
		return $module_id !== false;
32
	}
33
34
	/**
35
	 * @inheritdoc
36
	 */
37
	public static function depends_on()
38
	{
39
		return ['\phpbb\topicprefixes\migrations\install_schema'];
40
	}
41
42
	/**
43
	 * @inheritdoc
44
	 */
45
	public function update_data()
46
	{
47
		return [
48
			['module.add', ['acp', 'ACP_CAT_DOT_MODS', 'ACP_TOPIC_PREFIXES']],
49
			['module.add', ['acp', 'ACP_TOPIC_PREFIXES', [
50
				'module_basename'	=> '\phpbb\topicprefixes\acp\topic_prefixes_module',
51
				'modes'				=> ['manage'],
52
			]]],
53
		];
54
	}
55
}
56