The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
The index thread function in global.php is another guilty
party of using a while loop to execute queries. This does away with that. I tested it on my test board with regular users and guests and all was well. Find these two lines in global.php and replace it with my code below: Code:
// ###################### Start indexthread ####################### Code:
// ###################### Start makeforumjump ####################### Insert this code in place Code:
function indexthread($threadid) {
//adds a thread into the search index
global $DB_site;
$thread=$DB_site->query_first("SELECT threadid,title FROM thread WHERE threadid=$threadid");
$subject=$thread[title];
$posts=$DB_site->query("SELECT post.userid, post.username AS guestname, pagetext, user.username AS username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE threadid=$thread[threadid] AND visible=1");
while ($post=$DB_site->fetch_array($posts))
{
if ($post[userid]!=0)
{
if ($post[username] != "")
{
$usernames.=" $post[username] ";
}
}
else
{
if ($post[guestname] != "")
{
$usernames.=" $post[guestname] ";
}
}
$pagetext.=" $post[pagetext] ";
}
$subject=wordsonly($subject);
$pagetext=$subject." ".wordsonly($pagetext);
$usernames=wordsonly($usernames);
$DB_site->query("UPDATE thread SET subjectindex=' ".addslashes($subject)." ',threadindex=' ".addslashes($pagetext)." ',userindex=' ".addslashes($usernames)." ' WHERE threadid=$threadid");
return 1;
}
Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
[rant]
John should replace the spaces used around the usernames above with commas and then disallow commas as a character in user name. 1 - I could then release the dot hack 2 - Search By User would then work 100% |
|
#3
|
|||
|
|||
|
Also I see where we can optimize index.php but I don't want to touch that until after version 2.0. Hopefully John can do that one..
|
|
#4
|
|||
|
|||
|
damn but you're cranking them out hot and heavy!
keep up the good work. So far you have increased my board speed quite a bit
|
|
#5
|
|||
|
|||
|
This one was a piece of cake compare to the forumjump optimization. The same type of optimization done to forumjump can be done to index.php but it will take a few hours to do and considering it will probably change in v2.0, I want to wait.
|
|
#6
|
|||
|
|||
|
the mythical version 2!
I'll give ya a nickle if you do it
|
|
#7
|
|||
|
|||
|
Quote:
|
|
#8
|
|||
|
|||
|
by the time they are done they will have serveal.
|
![]() |
|
|