Completed
Push — master ( 95b8a1...557c23 )
by Matt
03:20
created

release_1_4_3_data   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A effectively_installed() 0 4 1
A depends_on() 0 4 1
A update_data() 0 6 1
A get_default_sensitivity() 0 6 2
1
<?php
2
/**
3
 *
4
 * Precise Similar Topics
5
 *
6
 * @copyright (c) 2018 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_4_3_data extends \phpbb\db\migration\migration
14
{
15
	public function effectively_installed()
16
	{
17
		return $this->config->offsetExists('similar_topics_sense');
18
	}
19
20
	static public function depends_on()
21
	{
22
		return array('\vse\similartopics\migrations\release_1_4_1_schema');
23
	}
24
25
	public function update_data()
26
	{
27
		return array(
28
			array('config.add', array('similar_topics_sense', $this->get_default_sensitivity())),
29
		);
30
	}
31
32
	/**
33
	 * Get default sensitivity setting
34
	 * Seems like 5 will be best for MyISAM and 1 will be best for InnoDB
35
	 *
36
	 * @return int
37
	 */
38
	public function get_default_sensitivity()
39
	{
40
		$fulltext_support = new \vse\similartopics\core\fulltext_support($this->db);
41
42
		return $fulltext_support->get_engine() === 'innodb' ? 1 : 5;
43
	}
44
}
45