Completed
Push — master ( 3ef6ac...8b656c )
by Matt
11s
created

install_acp_module::update_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 18
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\admanagement\migrations;
12
13
class install_acp_module extends \phpbb\db\migration\migration
14
{
15
	public function effectively_installed()
16
	{
17
		$sql = 'SELECT module_id
18
			FROM ' . $this->table_prefix . "modules
19
			WHERE module_class = 'acp'
20
				AND module_langname = 'ACP_ADMANAGEMENT_TITLE'";
21
		$result = $this->db->sql_query($sql);
22
		$module_id = (int) $this->db->sql_fetchfield('module_id');
23
		$this->db->sql_freeresult($result);
24
25
		return $module_id;
26
	}
27
28
	static public function depends_on()
1 ignored issue
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
29
	{
30
		return array('\phpbb\db\migration\data\v310\gold');
31
	}
32
33
	public function update_data()
34
	{
35
		return array(
36
			array('module.add', array(
37
				'acp',
38
				'ACP_CAT_DOT_MODS',
39
				'ACP_ADMANAGEMENT_TITLE'
40
			)),
41
			array('module.add', array(
42
				'acp',
43
				'ACP_ADMANAGEMENT_TITLE',
44
				array(
45
					'module_basename'	=> '\phpbb\admanagement\acp\main_module',
46
					'modes'				=> array('settings'),
47
				),
48
			)),
49
		);
50
	}
51
}
52