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\release_1_5_x; |
12
|
|
|
|
13
|
|
|
class mysql_index extends \phpbb\db\migration\migration |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Do not run this migration if the DB is not MySQL |
17
|
|
|
* |
18
|
|
|
* @return bool |
19
|
|
|
*/ |
20
|
|
|
public function effectively_installed() |
21
|
|
|
{ |
22
|
|
|
return strpos($this->db->get_sql_layer(), 'mysql') !== 0; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public static function depends_on() |
26
|
|
|
{ |
27
|
|
|
return array( |
28
|
|
|
'\vse\similartopics\migrations\release_1_1_0_data', |
29
|
|
|
'\vse\similartopics\migrations\release_1_3_0_fulltext', |
30
|
|
|
'\vse\similartopics\migrations\release_1_4_3_data', |
31
|
|
|
); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function update_data() |
35
|
|
|
{ |
36
|
|
|
return array( |
37
|
|
|
array('if', array( |
38
|
|
|
strpos($this->db->get_sql_layer(), 'mysql') === 0, |
39
|
|
|
array('custom', array(array($this, 'add_topic_title_fulltext'))), |
40
|
|
|
)), |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Add a MYSQLI FULLTEXT index to phpbb_topics.topic_title (if needed). |
46
|
|
|
* |
47
|
|
|
* This is a retry of the similar action in release_1_1_0_data. |
48
|
|
|
* The first attempt would miss older InnoDB tables that do not support |
49
|
|
|
* FULLTEXT. If that happened, then this will convert the table to |
50
|
|
|
* MyISAM so we can then create the fulltext index. The old storage |
51
|
|
|
* engine will be stored so it can be reverted on uninstall. |
52
|
|
|
* Data is reverted in the release_1_3_0_fulltext migration. |
53
|
|
|
*/ |
54
|
|
|
public function add_topic_title_fulltext() |
55
|
|
|
{ |
56
|
|
|
$driver = $this->get_driver(); |
57
|
|
|
|
58
|
|
|
if (!$driver->is_fulltext('topic_title')) |
59
|
|
|
{ |
60
|
|
|
// Store the original database storage engine in a config var for recovery on uninstall |
61
|
|
|
$this->config->set('similar_topics_fulltext', (string) $driver->get_engine()); |
62
|
|
|
|
63
|
|
|
// Create the FULLTEXT index |
64
|
|
|
$driver->create_fulltext_index('topic_title'); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Get an instance of the similartopics mysqli driver |
70
|
|
|
* |
71
|
|
|
* @return \vse\similartopics\driver\mysqli |
72
|
|
|
*/ |
73
|
|
|
protected function get_driver() |
74
|
|
|
{ |
75
|
|
|
return new \vse\similartopics\driver\mysqli($this->db); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths