Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Post count not updating.

Hello, I am currently having a problem where on my site the Discussion Count does not update in the category after posting. Is there any way to fix this?

vincitydaimo
«1

Comments

  • I'm having the same problem.

  • CaylusCaylus ✭✭

    Could you try visiting yourforum/dba/counts to see if that fixes your problem?

  • x00x00 MVP

    /dba/counts will recalculate

    It can be that there is a denormalise config setting so that counts are updated every post but every n posts, it can also be a problem with caching.

    2.5 is very new, so worth opening an issue on github

    grep is your friend.

  • I have the same problem after updating to 2.5.1.
    running /dba/counts resets the counters but they still won't update on their own.

    Recalculate Conversation.CountMessages
    Recalculate Conversation.CountParticipants
    Recalculate Conversation.FirstMessageID
    Recalculate Conversation.LastMessageID
    Recalculate Conversation.DateUpdated
    Recalculate Conversation.UpdateUserID
    Recalculate Discussion.CountComments
    Recalculate Discussion.FirstCommentID
    Recalculate Discussion.LastCommentID
    Recalculate Discussion.DateLastComment
    Recalculate Discussion.LastCommentUserID
    100%
    Recalculate Category.CountDiscussions
    Recalculate Category.CountAllDiscussions
    Recalculate Category.CountComments
    Recalculate Category.CountAllComments
    Recalculate Category.LastDiscussionID
    Recalculate Category.LastCommentID
    Recalculate Category.LastDateInserted
    Recalculate Tag.CountDiscussions

  • BTW, the counters may have stopped working after I deleted a user (including data).

  • Ivan_GurinIvan_Gurin Moscow

    It's old bug. You must wait until number of discussions or number of comments in discussion will be great then current number. Or you can recalculate counters. Same behavior when you split or merge or move discussions.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @x00 said:
    /dba/counts will recalculate

    It can be that there is a denormalise config setting so that counts are updated every post but every n posts, it can also be a problem with caching.

    2.5 is very new, so worth opening an issue on github

    There is a config setting 'Vanilla.Views.Denormalize' used in the DiscussionModel which defaults to false, but I really do not know the purpose of that setting.

    You can try adding $Configuration['Vanilla']['Views']['Denormalize'] = true; to your config.php and see if that changes something... :confused:

  • SugarFreeSugarFree New
    edited March 7

    adding $Configuration['Vanilla']['Views']['Denormalize'] = true; to config.php didn't change anything. Nor other values: false, '1'.
    I also reinstalled Vanilla 2.5.1, starting with an empty directory. Didn't help.
    Recalculating counters doesn't help either. The counters just don't... count.

  • @Ivan_Gurin said:
    It's old bug. You must wait until number of discussions or number of comments in discussion will be great then current number. Or you can recalculate counters. Same behavior when you split or merge or move discussions.

    does this bug affect everyone, or are some counters more lucky?

  • I'm having the same issue

  • LincLinc Director of Development Detroit Vanilla Staff
    edited March 16

    @R_J said:
    There is a config setting 'Vanilla.Views.Denormalize' used in the DiscussionModel which defaults to false, but I really do not know the purpose of that setting.

    If you use memcached, we store pageview counts in its cache until it gets to 10 before adding that increment of 10 to the database counter. This reduces writes to the database dramatically. The downside to this is that clearing the cache can lose up to 9 views per discussion, so if you're running a small site and notice tiny increments like that & clear the cache regularly (like during a deploy) it can be irritating. So that config passes thru all the writes to the database, which isn't the worst thing on a low-traffic site. If you're not using memcached, the setting does nothing.

    If you're getting a few thousand or more pageviews a day I'd leave it set to the default.

  • LincLinc Director of Development Detroit Vanilla Staff
    edited March 16

    Pageview counters in Vanilla happen asynchronously via Javascript to conserve resources and avoid counting bot views. If you have any Javascript errors on your site, that would cause pageviews to stop. In your browser's web development console, look for a call to /settings/analyticstick.json. If it's not firing, look for a Javascript error. If it is firing, look to see if an error is being returned by your server.

  • Did anyone get this fixed? Cause I have the exact same problem and /settings/analyticstick.json seems to work just fine.

  • Is there any update on this? I am looking to set up a new forum and whilst testing Vanilla I moved a post and all category counters except General have stopped incrementing. This would be a show stopper for me as it will only be a low traffic forum (I expect). I ran the ‘dba/count’ script and that fixed the numbers but it is still not updating when I make new posts.
    Is there a setting that I can change?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @teppsta said:
    Is there any update on this? I am looking to set up a new forum and whilst testing Vanilla I moved a post and all category counters except General have stopped incrementing. This would be a show stopper for me as it will only be a low traffic forum (I expect). I ran the ‘dba/count’ script and that fixed the numbers but it is still not updating when I make new posts.
    Is there a setting that I can change?

    Nope, no setting. What is not updating?

    a) The total number of discussion for "All Categories"
    b) The number of discussions per category
    c) The number of comments per discussion

  • Hi. Thanks for the response. All Categories, My bookmarks, and My Discussions all increment as expected. None of the category counts are incrementing when I add new posts.

  • Post views and comments increment ok

  • I think everything was working ok until I moved a post to a different category - and after that they stopped moving. If I use the /dba/counts trigger then they reset to the correct numbers but still do not increment thereafter.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @teppsta said:
    Hi. Thanks for the response. All Categories, My bookmarks, and My Discussions all increment as expected. None of the category counts are incrementing when I add new posts.

    When you add a new discussion, you mean.

    If you look at the /categories page, you should see a link to the last discussion below each category. Does this show the correct discussion or is this information is also not updated?

  • rgprgp London New
    edited September 12

    I have been seeing something similar - number of discussions against each category not updating when a new discussion is added, and the most recent discussion not updating for each category on the forum/categories page.

    I have tracked down the problem, at least for the number of discussions, for my site. Not yet fixed the 'most recent' link, but I suspect the root cause will be similar.

    In my case (on my webhost only, not on my local PC, making debugging more laborious) I traced it back to the fact that PDO seems to be returning all columns as strings. I still haven't worked out why -- the usual reason is if PDO::ATTR_EMULATE_PREPARES is true, but it's false here. I also tried setting PDO::ATTR_STRINGIFY_FETCHES to false (it should be by default anyway), but that made no difference.

    Anyway, the consequence is that the CategoryId on the Discussion record is being returned as a string, so CategoryModel->get() assumes that it's looking for a slug rather than a primary key, and never finds the category to be updated.

    As quick workaround, I have added the following to CategoryModel->incrementLastDiscussion() (unfortunately not in an easily overridable function):

            if (is_numeric($categoryID))
            {
                $categoryID = intval($categoryID);
            }
    

    I'll report back once I've found a fix for the 'most recent discussion' problem, and if I get to the bottom of the PDO behaviour.

    PS: Just noticed that this was posted in '2.5 help' -- my site is actually using 2.6.1.

  • rgprgp London New

    The solution to the 'most recent' not updating was to add the same code to CategoryModel->updateLastPost().

  • rgprgp London New

    It looks like my web host isn't using mysqlnd as the PDO MySQL driver :-)

    Obviously specific to my webhost, but might possibly account for some of the other folk's problems with this issue, too?

  • @rgp Try adding this to your configuration:

    $Configuration['Database']['ConnectionOptions'] = [PDO::ATTR_STRINGIFY_FETCHES => false, PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true];
    

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • rgprgp London New
    edited September 13

    @Bleistivt Thanks for the suggestion, but PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE is a SQL Server specific constant -- it isn't defined in the PHP build on my webhost.

  • rgprgp London New

    Given the reliance on mysqlnd, though it's not listed as a requirement, I've raised an issue for this:

    https://github.com/vanilla/vanilla/issues/7770

  • You have completely lost me ther but I will keep following this thread in case a fix is found. I think this is the niceset forum software I have found but not usable with this bug

  • rgprgp London New

    Hi @teppsta.

    I suggest you check if your installation is using mysqlnd as its PDO MySQL driver -- if it is not, your problem is likely to be the same as mine, but if it is, it's definitely something different.

    To check, create a single-line PHP file, containing just the following:

    <?php phpinfo();  
    

    Upload this file to your forum directory and run it. In the resulting web page, search for the PDO Driver for MySQL section. If the Client API version is anything other than mysqlnd, the workarounds I described above will likely fix your problem too.

  • Yes having the same issue 2.6.1 categories not showing post counts or comment counts

  • Thanks RGP !

    I have had my service provider check and they state that whilst MySQLnd is present it is not used. Rather the connection is done with the default mysql client library.

    They created a script which you can see at :

    http://teppett.com/Vanilla/i.php

    I hope this may lead to a simple solution !

    Many thanks

    Simon

  • rgprgp London New

    I have had my service provider check and they state that whilst MySQLnd is present it is not used. Rather the connection is done with the default mysql client library.

    In that case the workaround I described above (in CategoryModel->incrementLastDiscussion() and CategoryModel->updateLastPost() (in file /applications/vanilla/models/class.categorymodel.php) should fix it for you.

    Unfortunately these are not overridable functions, so you'll have to edit the core file and reapply the fix each time you upgrade (until a permanent fix is made to the core files).

    Richard.

«1
Sign In or Register to comment.