Skip to content

Commit

Permalink
ARC2_Store removed all Fulltext related functions
Browse files Browse the repository at this point in the history
because they are not used inside ARC2

interacting with the database from outside of ARC2 is not recommended
  • Loading branch information
k00ni committed Jun 20, 2018
1 parent 861b72d commit 16a7988
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 85 deletions.
57 changes: 0 additions & 57 deletions store/ARC2_Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,63 +199,6 @@ public function hasHashColumn($tbl)
return $this->$var_name;
}

public function hasFulltextIndex()
{
if (!isset($this->has_fulltext_index)) {
$this->has_fulltext_index = 0;
$tbl = $this->getTablePrefix().'o2val';

$rows = $this->db->fetchList('SHOW INDEX FROM '.$tbl);
foreach($rows as $row) {
if ('val' != $row['Column_name']) {
continue;
}
if ('FULLTEXT' != $row['Index_type']) {
continue;
}
$this->has_fulltext_index = 1;
break;
}
}

return $this->has_fulltext_index;
}

public function enableFulltextSearch()
{
if ($this->hasFulltextIndex()) {
return 1;
}
$tbl = $this->getTablePrefix().'o2val';

// MySQL 5.5 does not support FULLTEXT for InnoDB based on:
// https://dev.mysql.com/doc/refman/5.5/en/fulltext-restrictions.html
// We execute this only on MySQL 5.6 or higher.
if ((
'mysql' == $this->db->getDBSName()
&& version_compare('5.6', $this->db->getServerVersion(), '<=')
) || 'mariadb' == $this->db->getDBSName()) {
$this->db->simpleQuery('CREATE FULLTEXT INDEX vft ON '.$tbl.'(val(128))');
return 1;
} else {
return 0;
}
}

public function disableFulltextSearch()
{
// MySQL 5.5 does not support FULLTEXT for InnoDB based on:
// https://dev.mysql.com/doc/refman/5.5/en/fulltext-restrictions.html
// We execute this only on MySQL 5.6 or higher.
if ('mysql' == $this->db->getDBSName() && '5.6' <= $this->db->getServerVersion()) {
if (!$this->hasFulltextIndex()) {
return 1;
}
$tbl = $this->getTablePrefix().'o2val';
$this->db->simpleQuery('DROP INDEX vft ON '.$tbl);
}
}

public function countDBProcesses()
{
return $this->db->getNumberOfRows('SHOW PROCESSLIST');
Expand Down
28 changes: 0 additions & 28 deletions tests/db_adapter_depended/store/ARC2_StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,34 +316,6 @@ public function testDump()
$this->assertEquals($expectedXML, $dumpContent);
}

/*
* Tests for enableFulltextSearch
*/

public function testEnableFulltextSearch()
{
$res1 = $this->fixture->enableFulltextSearch();
$res2 = $this->fixture->disableFulltextSearch();

// expect a different result, depending on the MySQL version, because
// MySQL 5.5 does not support FULLTEXT for InnoDB based on:
// https://dev.mysql.com/doc/refman/5.5/en/fulltext-restrictions.html
// MariaDB is also affected.
if ((
'mysql' == $this->fixture->getDBObject()->getDBSName()
&& version_compare('5.6', $this->fixture->getDBObject()->getServerVersion(), '>')
) || 'mariadb' == $this->fixture->getDBObject()->getDBSName()) {
$this->assertEquals(0, $res1);
$this->assertEquals(0, $res2);
} else {
$this->assertEquals(1, $res1);
$this->assertEquals(1, $res2);
}

$this->assertEquals(0, $this->fixture->a['db_object']->getErrorCode());
$this->assertEquals('', $this->fixture->a['db_object']->getErrorMessage());
}

/*
* Tests for getDBVersion
*/
Expand Down

0 comments on commit 16a7988

Please sign in to comment.