mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- fixed bugs #1395, #1177, fixed floating point assignment bug within older php versions ($fraction), adjusted search a little bit by implementing a workaround for database timeouts (hopefully Paul will not slap me for this. :D) - should be tested within high-traffic boards or those affected by the database timeout.
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3585 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0d75cfc914
commit
d6bdd83306
7 changed files with 147 additions and 84 deletions
|
@ -246,7 +246,7 @@ function add_search_words($mode, $post_id, $post_text, $post_title = '')
|
||||||
|
|
||||||
if ($mode == 'single')
|
if ($mode == 'single')
|
||||||
{
|
{
|
||||||
remove_common('single', 0.4, $word);
|
remove_common('single', 4/10, $word);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -712,7 +712,7 @@ switch ($row['config_value'])
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
|
|
||||||
// Mark common words ...
|
// Mark common words ...
|
||||||
remove_common('global', 0.4);
|
remove_common('global', 4/10);
|
||||||
|
|
||||||
// remove superfluous polls ... grab polls with topics then delete polls
|
// remove superfluous polls ... grab polls with topics then delete polls
|
||||||
// not in that list
|
// not in that list
|
||||||
|
|
|
@ -1926,7 +1926,7 @@ if ( !empty($next) )
|
||||||
// Remove common words after the first 2 batches and after every 4th batch after that.
|
// Remove common words after the first 2 batches and after every 4th batch after that.
|
||||||
if ( $batchcount % 4 == 3 )
|
if ( $batchcount % 4 == 3 )
|
||||||
{
|
{
|
||||||
remove_common('global', 0.4);
|
remove_common('global', 4/10);
|
||||||
}
|
}
|
||||||
|
|
||||||
print " <span class=\"ok\"><b>OK</b></span><br />\n";
|
print " <span class=\"ok\"><b>OK</b></span><br />\n";
|
||||||
|
|
|
@ -115,9 +115,7 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
redirect(append_sid("index.$phpEx", true));
|
||||||
redirect(append_sid("index.$phpEx", true));
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -145,6 +145,10 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
{
|
{
|
||||||
$store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars');
|
$store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Search ID Limiter, decrease this value if you experience further timeout problems with searching forums
|
||||||
|
$limiter = 5000;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cycle through options ...
|
// Cycle through options ...
|
||||||
//
|
//
|
||||||
|
@ -175,7 +179,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
{
|
{
|
||||||
$sql = "SELECT post_id
|
$sql = "SELECT post_id
|
||||||
FROM " . POSTS_TABLE . "
|
FROM " . POSTS_TABLE . "
|
||||||
WHERE poster_id = " . $userdata['user_id'];;
|
WHERE poster_id = " . $userdata['user_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -215,6 +219,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
$sql = "SELECT post_id
|
$sql = "SELECT post_id
|
||||||
FROM " . POSTS_TABLE . "
|
FROM " . POSTS_TABLE . "
|
||||||
WHERE poster_id IN ($matching_userids)";
|
WHERE poster_id IN ($matching_userids)";
|
||||||
|
|
||||||
|
if ($search_time)
|
||||||
|
{
|
||||||
|
$sql .= " AND post_time >= " . $search_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
if ( !($result = $db->sql_query($sql)) )
|
||||||
|
@ -399,6 +408,36 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
if ( $total_match_count )
|
if ( $total_match_count )
|
||||||
{
|
{
|
||||||
if ( $show_results == 'topics' )
|
if ( $show_results == 'topics' )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// This one is a beast, try to seperate it a bit (workaround for connection timeouts)
|
||||||
|
//
|
||||||
|
$search_id_chunks = array();
|
||||||
|
$count = 0;
|
||||||
|
$chunk = 0;
|
||||||
|
|
||||||
|
if (count($search_ids) > $limiter)
|
||||||
|
{
|
||||||
|
for ($i = 0; $i < count($search_ids); $i++)
|
||||||
|
{
|
||||||
|
if ($count == $limiter)
|
||||||
|
{
|
||||||
|
$chunk++;
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search_id_chunks[$chunk][$count] = $search_ids[$i];
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$search_id_chunks[0] = $search_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search_ids = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($search_id_chunks); $i++)
|
||||||
{
|
{
|
||||||
$where_sql = '';
|
$where_sql = '';
|
||||||
|
|
||||||
|
@ -411,7 +450,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
{
|
{
|
||||||
$sql = "SELECT topic_id
|
$sql = "SELECT topic_id
|
||||||
FROM " . POSTS_TABLE . "
|
FROM " . POSTS_TABLE . "
|
||||||
WHERE post_id IN (" . implode(", ", $search_ids) . ")
|
WHERE post_id IN (" . implode(", ", $search_id_chunks[$i]) . ")
|
||||||
$where_sql
|
$where_sql
|
||||||
GROUP BY topic_id";
|
GROUP BY topic_id";
|
||||||
}
|
}
|
||||||
|
@ -433,7 +472,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
|
|
||||||
$sql = "SELECT p.topic_id
|
$sql = "SELECT p.topic_id
|
||||||
FROM $from_sql
|
FROM $from_sql
|
||||||
WHERE p.post_id IN (" . implode(", ", $search_ids) . ")
|
WHERE p.post_id IN (" . implode(", ", $search_id_chunks[$i]) . ")
|
||||||
$where_sql
|
$where_sql
|
||||||
GROUP BY p.topic_id";
|
GROUP BY p.topic_id";
|
||||||
}
|
}
|
||||||
|
@ -443,19 +482,46 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_ids = array();
|
while ($row = $db->sql_fetchrow($result))
|
||||||
while( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
{
|
||||||
$search_ids[] = $row['topic_id'];
|
$search_ids[] = $row['topic_id'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
$total_match_count = sizeof($search_ids);
|
$total_match_count = sizeof($search_ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( $search_author != '' || $search_time || $auth_sql != '' )
|
else if ( $search_author != '' || $search_time || $auth_sql != '' )
|
||||||
{
|
{
|
||||||
$where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_ids) . ')' : 'p.post_id IN (' . implode(', ', $search_ids) . ')';
|
$search_id_chunks = array();
|
||||||
|
$count = 0;
|
||||||
|
$chunk = 0;
|
||||||
|
|
||||||
|
if (count($search_ids) > $limiter)
|
||||||
|
{
|
||||||
|
for ($i = 0; $i < count($search_ids); $i++)
|
||||||
|
{
|
||||||
|
if ($count == $limiter)
|
||||||
|
{
|
||||||
|
$chunk++;
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search_id_chunks[$chunk][$count] = $search_ids[$i];
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$search_id_chunks[0] = $search_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search_ids = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($search_id_chunks); $i++)
|
||||||
|
{
|
||||||
|
$where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')' : 'p.post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')';
|
||||||
$from_sql = ( $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';
|
$from_sql = ( $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';
|
||||||
|
|
||||||
if ( $search_time )
|
if ( $search_time )
|
||||||
|
@ -483,13 +549,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_ids = array();
|
|
||||||
while( $row = $db->sql_fetchrow($result) )
|
while( $row = $db->sql_fetchrow($result) )
|
||||||
{
|
{
|
||||||
$search_ids[] = $row['post_id'];
|
$search_ids[] = $row['post_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
$total_match_count = count($search_ids);
|
$total_match_count = count($search_ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<td valign="middle" nowrap="nowrap">{PROFILE_IMG} {PM_IMG} {EMAIL_IMG}
|
<td valign="middle" nowrap="nowrap">{PROFILE_IMG} {PM_IMG} {EMAIL_IMG}
|
||||||
{WWW_IMG} {AIM_IMG} {YIM_IMG} {MSN_IMG}</td><td> </td><td valign="top" nowrap="nowrap"><script language="JavaScript" type="text/javascript"><!--
|
{WWW_IMG} {AIM_IMG} {YIM_IMG} {MSN_IMG}</td><td> </td><td valign="top" nowrap="nowrap"><script language="JavaScript" type="text/javascript"><!--
|
||||||
|
|
||||||
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
|
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
|
||||||
document.write('{ICQ_IMG}');
|
document.write('{ICQ_IMG}');
|
||||||
else
|
else
|
||||||
document.write('<div style="position:relative"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px">{ICQ_STATUS_IMG}</div></div>');
|
document.write('<div style="position:relative"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px">{ICQ_STATUS_IMG}</div></div>');
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
<td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_ICQ_NUMBER}:</span></td>
|
<td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_ICQ_NUMBER}:</span></td>
|
||||||
<td class="row1"><script language="JavaScript" type="text/javascript"><!--
|
<td class="row1"><script language="JavaScript" type="text/javascript"><!--
|
||||||
|
|
||||||
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
|
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
|
||||||
document.write(' {ICQ_IMG}');
|
document.write(' {ICQ_IMG}');
|
||||||
else
|
else
|
||||||
document.write('<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap="nowrap"><div style="position:relative;height:18px"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{ICQ_STATUS_IMG}</div></div></td></tr></table>');
|
document.write('<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap="nowrap"><div style="position:relative;height:18px"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{ICQ_STATUS_IMG}</div></div></td></tr></table>');
|
||||||
|
|
Loading…
Add table
Reference in a new issue