1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 00:37:42 +02:00

[ticket/12683] Pass tables via parameter and small fix

PHPBB3-12683
This commit is contained in:
rubencm
2021-04-09 19:36:54 +02:00
committed by Ruben Calvo
parent 565c806eda
commit f4977853be
16 changed files with 132 additions and 103 deletions

View File

@@ -19,8 +19,8 @@ use phpbb\event\dispatcher_interface;
use phpbb\language\language;
use phpbb\search\exception\index_created_exception;
use phpbb\search\exception\index_empty_exception;
use phpbb\search\exception\search_exception;
use phpbb\user;
use RuntimeException;
/**
* Fulltext search for PostgreSQL
@@ -86,19 +86,20 @@ class fulltext_postgres extends base implements search_backend_interface
* Constructor
* Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend
*
* @param config $config Config object
* @param driver_interface $db Database object
* @param config $config Config object
* @param driver_interface $db Database object
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
* @param language $language
* @param user $user User object
* @param string $phpbb_root_path Relative path to phpBB root
* @param string $phpEx PHP file extension
* @param language $language
* @param user $user User object
* @param string $search_results_table
* @param string $phpbb_root_path Relative path to phpBB root
* @param string $phpEx PHP file extension
*/
public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $search_results_table, string $phpbb_root_path, string $phpEx)
{
global $cache;
parent::__construct($cache, $config, $db, $user);
parent::__construct($cache, $config, $db, $user, $search_results_table);
$this->phpbb_dispatcher = $phpbb_dispatcher;
$this->language = $language;
@@ -878,7 +879,7 @@ class fulltext_postgres extends base implements search_backend_interface
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
{
throw new RuntimeException($error);
throw new search_exception($error);
}
if (empty($this->stats))
@@ -924,7 +925,7 @@ class fulltext_postgres extends base implements search_backend_interface
$this->db->sql_query($sql_query);
}
$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
$this->db->sql_query('TRUNCATE TABLE ' . $this->search_results_table);
return null;
}
@@ -942,7 +943,7 @@ class fulltext_postgres extends base implements search_backend_interface
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
{
throw new RuntimeException($error);
throw new search_exception($error);
}
if (empty($this->stats))
@@ -988,7 +989,7 @@ class fulltext_postgres extends base implements search_backend_interface
$this->db->sql_query($sql_query);
}
$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
$this->db->sql_query('TRUNCATE TABLE ' . $this->search_results_table);
return null;
}