mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 06:51:33 +02:00
[ticket/15540] Display only available search backends
PHPBB3-15540
This commit is contained in:
@@ -16,6 +16,7 @@ namespace phpbb\search\backend;
|
||||
use phpbb\auth\auth;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\db\tools\tools_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
use phpbb\user;
|
||||
|
||||
@@ -85,13 +86,13 @@ class fulltext_sphinx implements search_backend_interface
|
||||
|
||||
/**
|
||||
* Database connection
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
* @var driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Database Tools object
|
||||
* @var \phpbb\db\tools\tools_interface
|
||||
* @var tools_interface
|
||||
*/
|
||||
protected $db_tools;
|
||||
|
||||
@@ -180,6 +181,14 @@ class fulltext_sphinx implements search_backend_interface
|
||||
return 'Sphinx Fulltext';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function is_available(): bool
|
||||
{
|
||||
return ($this->db->get_sql_layer() == 'mysqli' || $this->db->get_sql_layer() == 'postgres') && class_exists('SphinxClient');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -211,7 +220,7 @@ class fulltext_sphinx implements search_backend_interface
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
|
||||
if (!$this->is_available())
|
||||
{
|
||||
return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];
|
||||
}
|
||||
@@ -922,9 +931,7 @@ class fulltext_sphinx implements search_backend_interface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associative array containing information about the indexes
|
||||
*
|
||||
* @return string|bool Language string of error false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function index_stats()
|
||||
{
|
||||
|
Reference in New Issue
Block a user