ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Topics and Replies don’t add up

February 19, 2008 8:53pm

Subscribe [4]
  • #1 / Feb 19, 2008 8:53pm

    Kelli

    30 posts

    Hi I’ve noticed that the stats within my forum don’t add up

    for example when I look at a forum with say a count of 8 topics and zero replies
    when I look into that forum I can count that there are: 8 topics but 128 replies,

    is there a way to recount

    I’ve already gone into admin/ utilities/ recount statistics and performed a recount but the stats still don’t add up?

    thank you for any help you may be able to offer..

  • #2 / Feb 19, 2008 9:39pm

    Sue Crocker

    26054 posts

    Kelli, are you using the most recent versions of EE and the forum module? Let’s make sure you’re all caught up first.

    Second.. do you have a link to where this is happening?

    Are you using the default forum template, or have you modified it?

  • #3 / Feb 19, 2008 10:59pm

    Kelli

    30 posts

    Hi Sue,

    I’m using EE 1.6.2
    and forum 2.0

    here is a link to where this is happening
    http://www.metso.co.uk/expressionengine/index.php/forums/

    default template.

  • #4 / Feb 20, 2008 10:42am

    Robin Sowell

    13255 posts

    Yep- they don’t add up at all.  Inside a given forum does- but the main page isn’t even in the ballpark.  Have you upgraded the forum in the past?  Wonder if it was a template change- so if you have upgraded, did you replace the forum templates with the latest- i.e., 2.0?

    If so- I don’t know if this will help, but go to the forum cp, ‘forum management’- see in the bottom right ‘Resynchronize Forums’- just see what that does to blow the dust out.

  • #5 / Feb 20, 2008 12:24pm

    Kelli

    30 posts

    Hi Robin,
    I tried the resync, but nothing has changed.

    Previous to this I brought the data from another phpBB database.

    Is there a way I can manually adjust?
    thank you

  • #6 / Feb 20, 2008 1:09pm

    Robin Sowell

    13255 posts

    Hm- don’t do anything yet.  But yea- it’s possible the import is what’s up.  But before we do anything- I’d upload a fresh copy of the 2.0 files and the forum themes.  Let’s just be dead sure it isn’t something in a theme that got switched.

    And- I’m going to dump some brainstorming below- don’t do anything with it yet.

    OK- the main page borked one is pulling from exp_forums- forum_total_posts.  The interior, non-borked count is pulling from exp_forum_topics- (thread_total - 1).

    Were the numbers ever correct?  Or ever correct once you did the import?  I suspect it’s the import that borked things- in which case I’ll probably shift this to ‘How to’ for some input.  If we try to do it manually- you’re going to want to back everything up.  And then we’ll need to think hard on the query.  I THINK it can be done with a straight query.  But I need to ponder.

    But first- let’s be sure it’s not a template issue and let’s square away whether things got off due to EE itself, or due to the imported data.

    Make sense?

  • #7 / Feb 20, 2008 1:23pm

    Kelli

    30 posts

    Were the numbers ever correct?

    Yes before in my previous forum, there tallied up correctly.

    Or ever correct once you did the import?

    Nope, since I imported yesterday, the numbers don’t tally up.

    you’re going to want to back everything up.

    How do you recommend backing up? phpmyadmin?

    export as a sql file

    Add custom comment into header (\n splits lines)
    Enclose export in a transaction
    Disable foreign key checks
    SQL compatibility mode
    Documentation
    Structure
    Add DROP TABLE / DROP VIEW
    Add IF NOT EXISTS
    Add AUTO_INCREMENT value
    Enclose table and field names with backquotes
    Add CREATE PROCEDURE / FUNCTION
    Add into comments
    Creation/Update/Check dates
    Data
    Complete inserts
    Extended inserts
    Maximal length of created query
    Use delayed inserts
    Use ignore inserts
    Use hexadecimal for BLOB
    Export type

     

    I THINK it can be done with a straight query.

    that’ll be nice!
    Forum2.0 Themes reinstalled along with other files…

    thanks Robin for your assistance..

  • #8 / Feb 20, 2008 1:37pm

    Robin Sowell

    13255 posts

    Yepers- looks good to me.  I’d probably backup just the forum tables as well- because if it borks, those are really the only ones that will need fixing.

    And- I’m going to shift this over to ‘How to’- and paste what I THINK will work.  But then I’m going to nudge the crew to look it over.  I’m not dead sure if the join is ok, but I think it will serve.

    UPDATE exp_forums, exp_forum_topics SET exp_forums.forum_total_replies = exp_forum_topics.thread_total-1 WHERE exp_forums.forum_id=exp_forum_topics.forum_id

    Anybody else want to chime in on how that looks to them- please do.  But I’d hold off on running it for a wee bit- let’s see if we can get some confirmation before you go for it.

  • #9 / Feb 20, 2008 7:10pm

    Kelli

    30 posts

    Hi since being moved to the How To forum, I’m wondering if I was better off in the technical section..

  • #10 / Feb 21, 2008 11:04am

    Robin Sowell

    13255 posts

    OK- just to note- no warranty on this one- it’s use at your own risk.  I just don’t have a good setup to test.  Be sure to get a good backup before proceeding- then you can try:

    UPDATE exp_forums, exp_forum_topics SET exp_forums.forum_total_posts = exp_forum_topics.thread_total-1 WHERE exp_forums.forum_id=exp_forum_topics.forum_id

    See if that does the trick.

  • #11 / Feb 23, 2008 10:03pm

    Derek Jones

    7561 posts

    Kelli, if you are certain that you have ran both the Forum Stats and the Forum Topics recounts in Admin > Utilities > Recount Statistics, then Robin’s query above isn’t likely to help, as the recount utility is quite through.  Since you’ve imported this data, all I can do is point you to likely sources that the information is off.  In this case I believe it is likely that the ‘thread_total’ column of exp_forum_topics is incorrect.  That would be what I would first examine.

  • #12 / Feb 24, 2008 6:43am

    Kelli

    30 posts

    Hi Derek, Robin, Sue,

    thank you for your support..

    I can confirm with much satisfaction that this is now working…

    It came down to my original import of data…being out of sync and incomplete.

    I was using the phpBB to EE script that I aquired from this
    Discussion thread for converting PHPBB data

    After many BACKUPS and getting my hands into the database, I managed to work out why the script was not importing the phpbb posts properly… in the phpBB_posts table amoung many rows in the field ‘poster ID’ I had lots of “-1” which I then changed to 1 because I having checked the phpbb_users table, I knew I didn’t have a user id of -1, though I did have a user id of 1, having checked on the original forum, and figuring out which posts had discrepancys, I figured out there were all originating from user id 1, so I changed the -1 in the phpBB_posts table.

    I did this by backing up the phpBB forum database as a sql document, opening it up in a text editor, locating the section/ block I wished to manipulate and copying and pasting into a nother text document and then doing a find and replace on all the -1’s,, copy and paste back in,

    reimport data into EE forum from this now amended phpBB database and full import without hitches.

    Now all the data was there, but there was still a miscount problem…

    I did a recount using the utilities/Recount Statistics

    and hooray all the topics and posts now match..

    It took a while for me to figure out… but it was worth it…

    thanks for the support. and thanks to all involved in preparing and writing the script I used…

  • #13 / Feb 24, 2008 10:07am

    Derek Jones

    7561 posts

    Glad your squared away, Kelli!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases