Forum topic/post count not updating instantly

Started by las7h0p3, June 11, 2013, 04:29:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

las7h0p3

#7
Edit:

Never mind I found a way to fix it, finally (whew). Thanks for all the help guys!

If anyone else has this problem here is what I did:

Copy this script:

        // update forum post/topic count
        $forums = mysql_query("select id from forums");
        while ($forum = mysql_fetch_assoc($forums))
        {
                $postcount = 0;
                $topiccount = 0;
                $topics = mysql_query("select id from topics where forumid=$forum[id]");
                while ($topic = mysql_fetch_assoc($topics))
                {
                        $res = mysql_query("select count(*) from posts where topicid=$topic[id]");
                        $arr = mysql_fetch_row($res);
                        $postcount += $arr[0];
                        ++$topiccount;
                }
                mysql_query("update forums set postcount=$postcount, topiccount=$topiccount where id=$forum[id]");
        }


and paste it after:

    $topiccount = number_format($forums_arr["topiccount"]);

    $postcount = number_format($forums_arr["postcount"]);


in forums.php

Cheers!

las7h0p3

#6
@Mindless

I checked cleanup.php and couldn't find anything wrong.

rushed

if you post your clean.php file that would be a huge help, mate fresh sets of eyes to help you out :)

Mindless

Well there will be a query that will update the count fields in forums, so once that hits, autoclean still has to run to grab that count, thats when you would see the updated value on index, something must be broken on cleanup and its not executing all the cleans probably, wee bit debugging and it should be easy to spot

las7h0p3

Yes but shouldn't the topic/post count update instantly when someone makes a new topic/post?

Mindless

900 secs is 15 minutes, maybe because autoclean is not being called its not updating as you expect it, if theres no activity on site ?

las7h0p3

Hey all,

My tbdev 2005 topic/post count doesn't update instantly. However it updates after around 30mins or so, also when I do docleanup.php. When I set $autoclean_interval = 900 to 1 it does not work. Anyone has any suggestions how to fix that?