aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/admin
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-07-25 15:50:57 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-07-25 15:50:57 +0000
commit9b35e2b168d6416b0e77b3caa6a86ebd83f8afab (patch)
treea9cd19f498cec46d27d26b8698926378c3387d5f /phpBB/admin
parent42f2152a9f69c75427afa394a3b95c1c9c556982 (diff)
downloadforums-9b35e2b168d6416b0e77b3caa6a86ebd83f8afab.tar
forums-9b35e2b168d6416b0e77b3caa6a86ebd83f8afab.tar.gz
forums-9b35e2b168d6416b0e77b3caa6a86ebd83f8afab.tar.bz2
forums-9b35e2b168d6416b0e77b3caa6a86ebd83f8afab.tar.xz
forums-9b35e2b168d6416b0e77b3caa6a86ebd83f8afab.zip
Throw in a load check for the hell of it ...
git-svn-id: file:///svn/phpbb/trunk@2742 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/admin')
-rw-r--r--phpBB/admin/admin_search.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/phpBB/admin/admin_search.php b/phpBB/admin/admin_search.php
index 5d0359f434..998955d401 100644
--- a/phpBB/admin/admin_search.php
+++ b/phpBB/admin/admin_search.php
@@ -54,6 +54,31 @@ if ( !$acl->get_acl_admin('general') )
//
if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
{
+ $batchsize = 200; // Process this many posts per batch
+ $batchstart = ( !isset($HTTP_GET_VARS['batchstart']) ) ? $row['min_post_id'] : $HTTP_GET_VARS['batchstart'];
+ $batchcount = ( !isset($HTTP_GET_VARS['batchcount']) ) ? 1 : $HTTP_GET_VARS['batchcount'];
+ $loopcount = 0;
+ $batchend = $batchstart + $batchsize;
+
+ //
+ // Search re-indexing is tough on the server ... so we'll check the load
+ // each loop and if we're on a 1min load of 3 or more we'll re-load the page
+ // and try again. No idea how well this will work in practice so we'll see ...
+ //
+ if ( file_exists('/proc/loadavg') )
+ {
+ if ( $load = @file('/proc/loadavg') )
+ {
+ list($load) = explode(' ', $load[0]);
+
+ if ( $load > 3 )
+ {
+ header("Location: admin_search.$phpEx$SID&batchstart=$batchstart&batchcount=$batch_count");
+ exit;
+ }
+ }
+ }
+
//
// Try and load stopword and synonym files
//
@@ -112,11 +137,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
$totalposts = $row['total'];
$max_post_id = $row['max_post_id'];
- $batchsize = 200; // Process this many posts per batch
- $batchstart = ( !isset($HTTP_GET_VARS['batchstart']) ) ? $row['min_post_id'] : $HTTP_GET_VARS['batchstart'];
- $batchcount = ( !isset($HTTP_GET_VARS['batchcount']) ) ? 1 : $HTTP_GET_VARS['batchcount'];
- $batchend = $batchstart + $batchsize;
-
+ $db->sql_freeresult($result);
+
$sql = "SELECT *
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id
@@ -251,6 +273,8 @@ if ( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['batchstart']) )
while ( $row = $db->sql_fetchrow($result) );
}
+ $db->sql_freeresult($result);
+
// Remove common words after the first 2 batches and after every 4th batch after that.
if ( $batchcount % 4 == 3 )
{