Archive for Before posting please check the "stickies" in the support forums.
Please ask questions in real English and not "txt". You will get a better response.
Please do not ask support questions via PMs.
  Forum Index -> Forum Blogs
myff admin

Faster forums part five

This one requires a little archeology.  We are running non standard code to clear out old search results, and I can't quite fathom why at the minute.

But the principle here is that every search on a phpbb2 forum does the work of clearing down old results. This in entirely unnecessary.  Sure it needs doing, but not on every search.

I have implemented this on downsizer (which runs the standard code) and "View Latest Posts" is noticeably nippier
myff admin

That change went in yesterday, todays change replaces a query:


         $sql = "SELECT COUNT(user_id) AS total
            FROM " . USERS_TABLE
            WHERE user_id <> " . ANONYMOUS . ";




         $sql = "SELECT COUNT(user_id) AS total
            FROM " . USERS_TABLE;


Since there is only ever one user with the ANONYMOUS id, we really don't need to run a straight forward row count into something that makes the database have to do any work, even if the work is minimal given the way the index will operate.
myff admin

Continuing the hunt for poor database queries in some instances a user may visit a forum link having presumably just registered, at any rate with their user_lastvisit at zero.


$sql = "SELECT t.forum_id, t.topic_id, p.post_time
         FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
         WHERE p.post_id = t.topic_last_post_id
            AND p.post_time > " . $userdata['user_lastvisit'] . "
            AND t.topic_moved_id = 0";

to determine new topics can then take an age to complete  

Many moons ago I fixed a similar absurdity on the index page, and I have now added this :


      // 60 days limit
      if ($userdata['user_lastvisit'] < (time() - 5184000))
         $userdata['user_lastvisit'] = time() - 5184000;

to stop the problem on viewing a forum.
myff admin

taking this further the new topics query is actually redundant in index.php as the info is available already. So that has now been removed. Forum Index -> Forum Blogs
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum