1 | <?php |
||
13 | class fulltext_support |
||
14 | { |
||
15 | /** @var \phpbb\db\driver\driver_interface */ |
||
16 | protected $db; |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $engine; |
||
20 | |||
21 | /** |
||
22 | * Constructor |
||
23 | * |
||
24 | * @param \phpbb\db\driver\driver_interface |
||
25 | * @access public |
||
26 | */ |
||
27 | public function __construct(\phpbb\db\driver\driver_interface $db) |
||
31 | |||
32 | /** |
||
33 | * Check if the database is using MySQL |
||
34 | * |
||
35 | * @return bool True if is mysql, false otherwise |
||
36 | */ |
||
37 | public function is_mysql() |
||
41 | |||
42 | /** |
||
43 | * Check for FULLTEXT index support |
||
44 | * |
||
45 | * @return bool True if FULLTEXT is supported, false otherwise |
||
46 | */ |
||
47 | public function is_supported() |
||
48 | { |
||
49 | // FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to |
||
50 | // http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html |
||
51 | return ($this->get_engine() === 'myisam' || ($this->get_engine() === 'innodb' && phpbb_version_compare($this->db->sql_server_info(true), '5.6.4', '>='))); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Get the database storage engine name |
||
56 | * |
||
57 | * @return string The storage engine name |
||
58 | */ |
||
59 | public function get_engine() |
||
63 | |||
64 | /** |
||
65 | * Set the database storage engine name |
||
66 | * |
||
67 | * @return string The storage engine name |
||
68 | */ |
||
69 | public function set_engine() |
||
90 | |||
91 | /** |
||
92 | * Check if a field is a FULLTEXT index |
||
93 | * |
||
94 | * @param string $field name of a field |
||
95 | * @return bool True if field is a FULLTEXT index, false otherwise |
||
96 | */ |
||
97 | public function index($field = 'topic_title') |
||
118 | |||
119 | /** |
||
120 | * Get topics table information |
||
121 | * |
||
122 | * @return mixed Array with the table info, false if the table does not exist |
||
123 | */ |
||
124 | protected function get_table_info() |
||
132 | } |
||
133 |