Quick note, since I'm in a hurry: there's a way to reduce the query count for the ubbthreads.php by making the following changes. Right now UBBT checks if there are new posts on this board, if yes, it checks how many new threads there are. Two queries. In this version, the first query grabs both numbers, and that's it.
Depending on the number of boards you can save 20% - 40% of the original number of queries. On
my BBS, there are ~150 boards (admin view, there are many private boards), and I save roughly 90 queries.
Anyways, instructions: Find (around line 312)...
// --------------------------------------------------------------
// Let's see how many new posts there are. We have to do some
// tricky AND/OR operations because we don't want sticky posts to
// be counted as new if they are not
$query = "
SELECT COUNT(*)
FROM w3t_Posts
WHERE ( (B_Posted > $checker AND B_Posted <> 4294967295)
OR (B_Posted = 4294967295 AND B_Sticky > $checker) )
$Viewable
AND B_Board = '$Board_q'
";
$newp = $dbh -> do_query($query);
list($newposts) = $dbh -> fetch_array($newp);
$dbh -> finish_sth($newposts);
if ($newposts) {
$shownew = "<br><font class="new">($newposts {$ubbt_lang['NEW_TEXT']})</font>";
}
// -----------------------------------------------------------
// If we have new posts let's see how many new threads we have
if ($newposts) {
$query = "
SELECT COUNT(*)
FROM w3t_Posts
WHERE ( (B_Posted > $checker AND B_Posted <> 4294967295)
OR (B_Posted = 4294967295 AND B_Sticky > $checker) )
$Viewable
AND B_Board = '$Board_q'
AND B_Topic = 1
";
$newt = $dbh -> do_query($query);
list($newthreads) = $dbh -> fetch_array($newt);
$dbh -> finish_sth($newt);
if ($newthreads) {
$shownewt = "<br><font class="new">($newthreads {$ubbt_lang['NEW_TEXT']})</font>";
}
}
... and replace with ...
// --------------------------------------------------------------
// Let's see how many new posts there are. We have to do some
// tricky AND/OR operations because we don't want sticky posts to
// be counted as new if they are not
// Routine changed to reduce query count
$query = "
SELECT COUNT(*), SUM(B_Topic)
FROM w3t_Posts
WHERE ( (B_Posted > $checker AND B_Posted <> 4294967295)
OR (B_Posted = 4294967295 AND B_Sticky > $checker) )
$Viewable
AND B_Board = '$Board_q'
";
$newp = $dbh -> do_query($query);
$newposts = $dbh -> fetch_array($newp);
$dbh -> finish_sth($newposts);
$newthreads = $newposts[1];
$newposts = $newposts[0];
if ($newposts) {
$shownew = "<br><font class="new">($newposts {$ubbt_lang['NEW_TEXT']})</font>";
}
// -----------------------------------------------------------
// If we have new posts let's see how many new threads we have
// Routine changed to reduce query count
if ($newthreads) {
$shownewt = "<br><font class="new">($newthreads {$ubbt_lang['NEW_TEXT']})</font>";
}
Voila, that's it. Don't forget to make a backup first. If you want to further reduce the load, replace the COUNT(*) with COUNT(B_IP). Same effect but might save a cycle or two. []
https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]