Passed
Pull Request — master (#8)
by
unknown
12:51
created

m1_acp_module::depends_on()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 * Akismet. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2018 Jakub Senko <[email protected]>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace senky\akismet\migrations\v10x;
12
13
class m1_acp_module extends \phpbb\db\migration\migration
14
{
15
	/**
16
	 * {@inheritDoc}
17
	 */
18
	public function effectively_installed()
19
	{
20
		$sql = 'SELECT module_id
21
			FROM ' . $this->table_prefix . "modules
22
			WHERE module_class = 'acp'
23
				AND module_langname = 'ACP_AKISMET_TITLE'";
24
		$result = $this->db->sql_query($sql);
25
		$module_id = (int) $this->db->sql_fetchfield('module_id');
26
		$this->db->sql_freeresult($result);
27
		return $module_id;
28
	}
29
30
	/**
31
	 * {@inheritDoc}
32
	 */
33
	static public function depends_on()
34
	{
35
		return array('\phpbb\db\migration\data\v32x\v321');
36
	}
37
38
	/**
39
	 * {@inheritDoc}
40
	 */
41
	public function update_data()
42
	{
43
		return array(
44
			array('module.add', array(
45
				'acp',
46
				'ACP_CAT_DOT_MODS',
47
				'ACP_AKISMET_TITLE'
48
			)),
49
			array('module.add', array(
50
				'acp',
51
				'ACP_AKISMET_TITLE',
52
				array(
53
					'module_basename' => '\senky\akismet\acp\akismet_module',
54
					'modes' => array('settings')
55
				),
56
			)),
57
		);
58
	}
59
}
60