aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/search.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-03-06 18:21:54 +0000
committerNils Adermann <naderman@naderman.de>2006-03-06 18:21:54 +0000
commit21f3fbc4be201a4fa277e65d30e694f0f75cb6ff (patch)
tree661005ebcac042d700535a8e19d373110b022fae /phpBB/includes/search/search.php
parent2246c8d6002660488914015a46cab8898f9a3943 (diff)
downloadforums-21f3fbc4be201a4fa277e65d30e694f0f75cb6ff.tar
forums-21f3fbc4be201a4fa277e65d30e694f0f75cb6ff.tar.gz
forums-21f3fbc4be201a4fa277e65d30e694f0f75cb6ff.tar.bz2
forums-21f3fbc4be201a4fa277e65d30e694f0f75cb6ff.tar.xz
forums-21f3fbc4be201a4fa277e65d30e694f0f75cb6ff.zip
Me, me, me!
- only search unapproved posts/topics in forums where the user got the m_approve permission - resize the search cache when it grows too huge (drop distant pages) - added unread link to search results page - streamlined search results and viewforum html code for displaying topics so we're waiting for David now :) git-svn-id: file:///svn/phpbb/trunk@5607 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/search/search.php')
-rwxr-xr-xphpBB/includes/search/search.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php
index daa3d62a4d..7a8a5ac1c3 100755
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/search.php
@@ -211,7 +211,7 @@ class search_backend
}
else
{
- // we use one set of resuts for both sort directions so we have to calculate the indizes
+ // we use one set of results for both sort directions so we have to calculate the indizes
// for the reversed array and we also have to reverse the ids themselves
if ($store[-2] != $sort_dir)
{
@@ -230,6 +230,29 @@ class search_backend
if (is_array($store_ids))
{
$store += $store_ids;
+
+ // if the cache is too big
+ if (sizeof($store) - 2 > 20 * $config['search_block_size'])
+ {
+ // remove everything in front of two blocks in front of the current start index
+ for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++)
+ {
+ if (isset($store[$i]))
+ {
+ unset($store[$i]);
+ }
+ }
+
+ // remove everything after two blocks after the current stop index
+ end($id_range);
+ for ($i = $store[-1] - 1, $n = current($id_range) + 2 * $config['search_block_size']; $i > $n; $i--)
+ {
+ if (isset($store[$i]))
+ {
+ unset($store[$i]);
+ }
+ }
+ }
$cache->put('_search_results_' . $search_key, $store, $config['search_store_results']);
$sql = 'UPDATE ' . SEARCH_TABLE . '