mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 15:57:45 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission
* 'develop' of https://github.com/phpbb/phpbb3: (480 commits) [ticket/6723] Show info that message has been deleted before delivery [ticket/11385] Fix issue with migration module tool not getting extension module info [ticket/11386] Fix failing tests from constructor changes [ticket/11386] Fix circular reference error & serialize error [ticket/11386] Remove tests that check if finder cache is working [ticket/11386] Forgot to get the migration classes [ticket/11386] Update tests with new constructors for ext.manager/migrator [ticket/11386] Use finder to find migration files [ticket/11363] Fix to make get_module_infos get from all extensions [ticket/11381] Make finder able to search in all available extensions [ticket/11103] Revert whitespace changes [ticket/11103] Few more minor language things [ticket/11103] Don't call generate_board_url many times [ticket/11103] Case time in queries as an int [ticket/11103] Fix effectively installed check [ticket/11103] Remove padding from notifications for now. [ticket/11363] Fix a couple bugs and throw errors if the file not found [ticket/11372] Migrator should only check if effectively installed if not [ticket/11363] Load module info files for extensions too [ticket/11103] Notifications Migration file ... Conflicts: phpBB/includes/functions_posting.php phpBB/includes/mcp/mcp_queue.php phpBB/includes/search/fulltext_mysql.php phpBB/includes/search/fulltext_native.php phpBB/includes/search/fulltext_postgres.php phpBB/includes/search/fulltext_sphinx.php phpBB/install/database_update.php phpBB/styles/prosilver/template/ajax.js
This commit is contained in:
@@ -343,7 +343,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
* @param int $per_page number of ids each page is supposed to contain
|
||||
* @return boolean|int total number of results
|
||||
*/
|
||||
public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
|
||||
public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
|
||||
{
|
||||
// No keywords? No posts
|
||||
if (!$this->search_query)
|
||||
@@ -371,6 +371,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
implode(',', $author_ary)
|
||||
)));
|
||||
|
||||
if ($start < 0)
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
// try reading the results from cache
|
||||
$result_count = 0;
|
||||
if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE)
|
||||
@@ -463,10 +468,14 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
$tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
|
||||
}
|
||||
|
||||
$this->db->sql_transaction('begin');
|
||||
|
||||
$sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p";
|
||||
$sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ")
|
||||
$sql_where_options";
|
||||
$sql = "SELECT $sql_select
|
||||
FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p
|
||||
WHERE (" . implode(' OR ', $tmp_sql_match) . ")
|
||||
$sql_where_options
|
||||
$sql_from
|
||||
$sql_where
|
||||
ORDER BY $sql_sort";
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||
|
||||
@@ -478,15 +487,15 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
if (!sizeof($id_ary))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if the total result count is not cached yet, retrieve it from the db
|
||||
if (!$result_count)
|
||||
{
|
||||
$result_count = sizeof ($id_ary);
|
||||
$sql_count = "SELECT COUNT(*) as result_count
|
||||
$sql_from
|
||||
$sql_where";
|
||||
$result = $this->db->sql_query($sql_count);
|
||||
$result_count = (int) $this->db->sql_fetchfield('result_count');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!$result_count)
|
||||
{
|
||||
@@ -494,6 +503,23 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->sql_transaction('commit');
|
||||
|
||||
if ($start >= $result_count)
|
||||
{
|
||||
$start = floor(($result_count - 1) / $per_page) * $per_page;
|
||||
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$id_ary[] = $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||
@@ -520,7 +546,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
* @param int $per_page number of ids each page is supposed to contain
|
||||
* @return boolean|int total number of results
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
|
||||
=======
|
||||
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
|
||||
>>>>>>> bee4f8d8185d4ff5278be758db4ea4a814f09b4f
|
||||
{
|
||||
// No author? No posts
|
||||
if (!sizeof($author_ary))
|
||||
@@ -544,6 +574,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
$author_name,
|
||||
)));
|
||||
|
||||
if ($start < 0)
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
// try reading the results from cache
|
||||
$result_count = 0;
|
||||
if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE)
|
||||
@@ -623,6 +658,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
$field = 'topic_id';
|
||||
}
|
||||
|
||||
$this->db->sql_transaction('begin');
|
||||
|
||||
// Only read one block of posts from the db and then cache it
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||
|
||||
@@ -635,7 +672,35 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
// retrieve the total result count if needed
|
||||
if (!$result_count)
|
||||
{
|
||||
$result_count = sizeof ($id_ary);
|
||||
if ($type == 'posts')
|
||||
{
|
||||
$sql_count = "SELECT COUNT(*) as result_count
|
||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$sql_firstpost
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
$sql_sort_join
|
||||
$sql_time";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_count = "SELECT COUNT(*) as result_count
|
||||
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$sql_firstpost
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
AND t.topic_id = p.topic_id
|
||||
$sql_sort_join
|
||||
$sql_time
|
||||
GROUP BY t.topic_id, $sort_by_sql[$sort_key]";
|
||||
}
|
||||
|
||||
$result = $this->db->sql_query($sql_count);
|
||||
$result_count = (int) $this->db->sql_fetchfield('result_count');
|
||||
|
||||
if (!$result_count)
|
||||
{
|
||||
@@ -643,6 +708,22 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->sql_transaction('commit');
|
||||
|
||||
if ($start >= $result_count)
|
||||
{
|
||||
$start = floor(($result_count - 1) / $per_page) * $per_page;
|
||||
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$id_ary[] = (int) $row[$field];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
}
|
||||
|
||||
if (sizeof($id_ary))
|
||||
{
|
||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||
|
Reference in New Issue
Block a user