Page 2 of 2
Posted: Fri Nov 14, 2008 11:06 am
by garvinhicking
Hi!
Thanks a lot for detecting this. There was an actual typo inside the code that used the wrong variable.
I committed a fix to SVN! Basically it was just this code in functions_comments.inc.php:
Code: Select all
$query = "UPDATE {$serendipity['dbPrefix']}entries
SET comments = " . (int)$counter_comments['counter'] . ",
trackbacks = " . (int)$counter_comments['trackbacks']. ",
last_modified = ". $lm ."
WHERE id = ". (int)$entry_id;
serendipity_db_query($query);
which needs to read:
Code: Select all
$query = "UPDATE {$serendipity['dbPrefix']}entries
SET comments = " . (int)$counter_comments['counter'] . ",
trackbacks = " . (int)$counter_tb['counter'] . ",
last_modified = ". $lm ."
WHERE id = ". (int)$entry_id;
serendipity_db_query($query);
Regards,
Garvin
Posted: Wed Dec 03, 2008 1:47 am
by yellowled
garvinhicking wrote:Thanks a lot for detecting this. There was an actual typo inside the code that used the wrong variable.
I committed a fix to SVN!
Hohum. I just noticed I'm
still getting this with the latest svn snapshot while testing a new template..?
Actually, the number of comments
is increased if I add another comment to an entry. Unfortunately, that entry was the only one in my test blog with "old" comments, so I just now forfeited my chance to test it again. Duh!
However, before this, my commented article showed "0 comments" (it had 2) until I added another one. Then it was updated correctly to "3 comments". (Yes, I checked it with a different template before adding the extra comment.)
Maybe this still isn't fixed properly?
YL
Posted: Wed Dec 03, 2008 1:25 pm
by garvinhicking
Hi!
This might only have happend for your old entries where a wrong count was stored. The fix applies only to new entries, so any comments that were added in the 1.4 cycle before the fix got committed, the comment count there would be wrong.
Regards,
Garvin
Posted: Wed Dec 03, 2008 7:30 pm
by Don Chambers
Guess what... me too. And this is in 1.3.2 (never released)..... now I was helping Judebert troubleshoot some of this stuff, and I think it was related to entry previews.....
Can we get a quick sql command that will re-count comments and trackbacks so they are again accurate?
Posted: Thu Dec 04, 2008 11:29 am
by garvinhicking
Hi!
Yeah, the forum search revealed this SQL:
http://board.s9y.org/viewtopic.php?t=12 ... mments+set
HTH,
Garvin
Posted: Thu Dec 04, 2008 2:59 pm
by Don Chambers
Thanks Garvin. Using that sql, one of my entries now says it has 5 comments and no trackbacks, when in fact it has 4 comments and 1 trackback.
Posted: Thu Dec 04, 2008 3:59 pm
by judebert
I think what you need is this:
Code: Select all
UPDATE serendipity_entries AS e SET e.comments = ( SELECT count( c.entry_id )
FROM serendipity_comments AS c
WHERE c.entry_id = e.id
AND c.status = 'approved'
AND c.type = 'NORMAL' ) , e.trackbacks = (
SELECT count( c.entry_id )
FROM serendipity_comments AS c
WHERE c.entry_id = e.id
AND c.status = 'approved'
AND c.type = 'TRACKBACK' )
There may be a smaller way to write this, but only Garvin would know. My SQL skills are rudimentary.
Posted: Sat Dec 13, 2008 10:09 pm
by Don Chambers
I committed a change to BP substantially similar to what I posted on the first page of this thread. The change adds classes for double opt-in comment subscriptions. For those who care, this is the change to content.tpl:
Code: Select all
{elseif $subscribe_confirm_error}
<div class="serendipity_Entry_Date">
<h3 class="serendipity_date">{$CONST.ERROR}</h3>
<div class="serendipity_msg_important comment_subscribe_error">{$content_message}</div>
</div>
{elseif $subscribe_confirm_success}
<div class="serendipity_Entry_Date">
<h3 class="serendipity_date">{$CONST.SUCCESS}</h3>
<div class="serendipity_msg_notice comment_subscribe_success">{$content_message}</div>
</div>
The modification will use bp's existing classes for important (red text) and notice (green text) if nothing else is defined by a colorset, or the new classes can be used to override/supplement those.
Re: Trackback/Comments counter not reliable in bullet proof?
Posted: Sun May 24, 2009 5:37 pm
by blog.brockha.us
Thanks, judebert, for your SQL snippet, I was too lazy all the time to do it on my own.
I paused blogging for half a year and started again now. Is there already a fix for the problem clearing trackback and comment counters? In the meantime nearly all newer articles of my blog were cleared, because they get new comments / trackbacks. Is it worth start upgrading for that matter?
Later: Upgraded my S9Y installation to the new 1.5 alpha version, I found in the repository. Yep! The problem seems to be fixed now! I will watch this topic a little, but thanks for now!

Re: Trackback/Comments counter not reliable in bullet proof?
Posted: Mon May 25, 2009 9:36 pm
by Don Chambers
Welcome back!!

Re: Trackback/Comments counter not reliable in bullet proof?
Posted: Tue May 26, 2009 1:52 pm
by blog.brockha.us
Thanks, Don.
