mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/15540] Code changes
PHPBB3-15540
This commit is contained in:
@@ -71,15 +71,15 @@ abstract class base implements search_backend_interface
|
||||
* Retrieves cached search results
|
||||
*
|
||||
* @param string $search_key an md5 string generated from all the passed search options to identify the results
|
||||
* @param int &$result_count will contain the number of all results for the search (not only for the current page)
|
||||
* @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache
|
||||
* @param int &$start indicates the first index of the page
|
||||
* @param int &$result_count will contain the number of all results for the search (not only for the current page)
|
||||
* @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache
|
||||
* @param int &$start indicates the first index of the page
|
||||
* @param int $per_page number of ids each page is supposed to contain
|
||||
* @param string $sort_dir is either a or d representing ASC and DESC
|
||||
*
|
||||
* @return int self::SEARCH_RESULT_NOT_IN_CACHE or self::SEARCH_RESULT_IN_CACHE or self::SEARCH_RESULT_INCOMPLETE
|
||||
*/
|
||||
protected function obtain_ids(string $search_key, &$result_count, &$id_ary, &$start, $per_page, string $sort_dir): int
|
||||
protected function obtain_ids(string $search_key, int &$result_count, array &$id_ary, int &$start, int $per_page, string $sort_dir): int
|
||||
{
|
||||
if (!($stored_ids = $this->cache->get('_search_results_' . $search_key)))
|
||||
{
|
||||
@@ -89,7 +89,7 @@ abstract class base implements search_backend_interface
|
||||
else
|
||||
{
|
||||
$result_count = $stored_ids[-1];
|
||||
$reverse_ids = ($stored_ids[-2] != $sort_dir) ? true : false;
|
||||
$reverse_ids = $stored_ids[-2] != $sort_dir;
|
||||
$complete = true;
|
||||
|
||||
// Change start parameter in case out of bounds
|
||||
@@ -106,7 +106,7 @@ abstract class base implements search_backend_interface
|
||||
}
|
||||
|
||||
// change the start to the actual end of the current request if the sort direction differs
|
||||
// from the dirction in the cache and reverse the ids later
|
||||
// from the direction in the cache and reverse the ids later
|
||||
if ($reverse_ids)
|
||||
{
|
||||
$start = $result_count - $start - $per_page;
|
||||
@@ -151,14 +151,14 @@ abstract class base implements search_backend_interface
|
||||
* @param string $keywords contains the keywords as entered by the user
|
||||
* @param array $author_ary an array of author ids, if the author should be ignored during the search the array is empty
|
||||
* @param int $result_count contains the number of all results for the search (not only for the current page)
|
||||
* @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element
|
||||
* @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element
|
||||
* must have the absolute index $start in the result set.
|
||||
* @param int $start indicates the first index of the page
|
||||
* @param string $sort_dir is either a or d representing ASC and DESC
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
protected function save_ids(string $search_key, string $keywords, $author_ary, int $result_count, &$id_ary, int $start, string $sort_dir)
|
||||
protected function save_ids(string $search_key, string $keywords, array $author_ary, int $result_count, array &$id_ary, int $start, string $sort_dir): void
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -268,7 +268,7 @@ abstract class base implements search_backend_interface
|
||||
* @param array $words
|
||||
* @param array|bool $authors
|
||||
*/
|
||||
protected function destroy_cache($words, $authors = false): void
|
||||
protected function destroy_cache(array $words, $authors = false): void
|
||||
{
|
||||
// clear all searches that searched for the specified words
|
||||
if (count($words))
|
||||
@@ -415,6 +415,8 @@ abstract class base implements search_backend_interface
|
||||
'rows_per_second' => $rows_per_second,
|
||||
];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -880,8 +880,7 @@ class fulltext_mysql extends base implements search_backend_interface
|
||||
);
|
||||
extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_index_before', compact($vars)));
|
||||
|
||||
unset($split_text);
|
||||
unset($split_title);
|
||||
unset($split_text, $split_title);
|
||||
|
||||
// destroy cached search results containing any of the words removed or added
|
||||
$this->destroy_cache($words, array($poster_id));
|
||||
@@ -1146,7 +1145,7 @@ class fulltext_mysql extends base implements search_backend_interface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acp(): array
|
||||
public function get_acp_options(): array
|
||||
{
|
||||
$tpl = '
|
||||
<dl>
|
||||
|
@@ -1996,7 +1996,7 @@ class fulltext_native extends base implements search_backend_interface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acp(): array
|
||||
public function get_acp_options(): array
|
||||
{
|
||||
/**
|
||||
* if we need any options, copied from fulltext_native for now, will have to be adjusted or removed
|
||||
|
@@ -343,16 +343,16 @@ class fulltext_postgres extends base implements search_backend_interface
|
||||
case 'u':
|
||||
$sql_sort_table = USERS_TABLE . ' u, ';
|
||||
$sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster ';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
$join_topic = true;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
$sql_sort_table = FORUMS_TABLE . ' f, ';
|
||||
$sql_sort_join = ' AND f.forum_id = p.forum_id ';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
// Build some display specific sql strings
|
||||
@@ -1081,7 +1081,7 @@ class fulltext_postgres extends base implements search_backend_interface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acp(): array
|
||||
public function get_acp_options(): array
|
||||
{
|
||||
$tpl = '
|
||||
<dl>
|
||||
|
@@ -783,7 +783,7 @@ class fulltext_sphinx implements search_backend_interface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acp(): array
|
||||
public function get_acp_options(): array
|
||||
{
|
||||
$config_vars = array(
|
||||
'fulltext_sphinx_data_path' => 'string',
|
||||
|
@@ -192,5 +192,5 @@ interface search_backend_interface
|
||||
*
|
||||
* @return array array containing template and config variables
|
||||
*/
|
||||
public function acp(): array;
|
||||
public function get_acp_options(): array;
|
||||
}
|
||||
|
@@ -44,11 +44,11 @@ class search_backend_factory
|
||||
/**
|
||||
* Obtains a specified search backend
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $class
|
||||
*
|
||||
* @return search_backend_interface
|
||||
*/
|
||||
public function get($class): search_backend_interface
|
||||
public function get(string $class): search_backend_interface
|
||||
{
|
||||
return $this->search_backends->get_by_class($class);
|
||||
}
|
||||
|
Reference in New Issue
Block a user