Completed
Push — master ( 4e9006...600a44 )
by Matt
02:55
created

release_1_3_0_data   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A effectively_installed() 0 4 2
A depends_on() 0 4 1
A update_data() 0 23 1
1
<?php
2
/**
3
*
4
* Precise Similar Topics
5
*
6
* @copyright (c) 2013 Matt Friedman
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace vse\similartopics\migrations;
12
13
class release_1_3_0_data extends \phpbb\db\migration\migration
14
{
15
	public function effectively_installed()
16
	{
17
		return isset($this->config['similar_topics_version']) && version_compare($this->config['similar_topics_version'], '1.3.0', '>=');
18
	}
19
20
	static public function depends_on()
21
	{
22
		return array('\vse\similartopics\migrations\release_1_3_0_schema');
23
	}
24
25
	public function update_data()
26
	{
27
		return array(
28
			// remove old ACP module if it exists
29
			array('if', array(
30
				array('module.exists', array('acp', 'PST_TITLE_ACP', 'PST_TITLE')),
31
				array('module.remove', array('acp', 'PST_TITLE_ACP', 'PST_TITLE')),
32
			)),
33
			array('if', array(
34
				array('module.exists', array('acp', 'PST_TITLE_ACP', 'PST_SETTINGS')),
35
				array('module.remove', array('acp', 'PST_TITLE_ACP', 'PST_SETTINGS')),
36
			)),
37
			// add new ACP module
38
			array('module.add', array(
39
				'acp', 'PST_TITLE_ACP', array(
40
					'module_basename'	=> '\vse\similartopics\acp\similar_topics_module',
41
					'modes'				=> array('settings'),
42
				),
43
			)),
44
			// Update existing configs
45
			array('config.update', array('similar_topics_version', '1.3.0')),
46
		);
47
	}
48
}
49