NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 08-19-2009 18:04:12

New member

Comment counts are able to be kept accurate as far as I can tell

functions.php claims that comment counts are not able to be kept accurate, presumably because deleting a picture won't update the comment counts. I fail to see why this is so. This changed kill_picture_slots function in paintsave.php seems to do the job:


function kill_picture_slot($resno) {
    // Need DB, names
    global $dbconn, $OekakiPoteto_Prefix, $OekakiPoteto_MemberPrefix;
    global $p_pic, $r_pic, $t_pic;

    // Remove all post files

    // Update commcounts
    $result = mysql_query ("SELECT COUNT(ID_3) AS comments, usrname FROM {$OekakiPoteto_Prefix}oekakicmt WHERE PIC_ID='{$resno}' GROUP BY usrname");
    while($row = mysql_fetch_array ($result))
        $result2 = mysql_query ("UPDATE {$OekakiPoteto_MemberPrefix}oekaki SET commcount=commcount-'{$row['comments']}' WHERE usrname='{$row['usrname']}'");

    // Now delete the DB entries
    $result = mysql_query ("DELETE FROM {$OekakiPoteto_Prefix}oekakicmt WHERE PIC_ID='{$resno}'");
    $result = mysql_query ("DELETE FROM {$OekakiPoteto_Prefix}oekakidta WHERE PIC_ID='{$resno}'");

    return TRUE;

GROUP BY would hand you the number of comments made by each user when a picture is killed...

Are there other obstacles to keeping comment counts accurate that I am unaware of?


#2 08-20-2009 02:39:54


Re: Comment counts are able to be kept accurate as far as I can tell

I think the original problem was more philosophical.  I asked people if they preferred that the comment count kept track of total comments posted over time, or the number of comments currently on the board.  Tracking total comments accurately is very difficult, because you have to distinguish between posts that were deleted or merely expired.  Tracking current comments is easy (and what the code you posted does), but it's not what people wanted.  That was back when Wacintaki recycled picture slots by resetting the picture offset number, and that caused a whole ton of problems in itself (namely, slots would be deleted out-of-order).

Wacintaki doesn't have the slot recycling problems anymore, so I think it would be a good idea to add comment count updates to the kill_picture_slot() function, but only if the slot is explicitly deleted by a moderator, rather than if the oekaki deletes the slot to free up server space.  Some of the code in this project is still 6+ years old, and a lot of things have been overlooked.  The counting system is definitely one of them!

Ideally, the best thing to do is to keep the picture slot and comments in the database, but only mark them with a "delete" flag.  Image files would be managed by total server space used, not a picture count.  I think that's how major hosting services manage galleries, and what I'm keeping in mind for the future.


#3 08-20-2009 07:23:15

New member

Re: Comment counts are able to be kept accurate as far as I can tell

Ahhh, I see... the users wanted to track all the comments they had ever made...?

Well, did they want these old comments to be made accessible/viewable? If not, it seems to me that the prime solution would be to increment an expired comment count at the same time as decrementing commcount, provided an optional variable is passed telling the oekaki to do this.

For example, say I have 2 comments. One expires. My commcount would go down to 1, but my expired_commcount would rise by 1. At that point, just add up the values to get the total count. This lets you know how many current and old comments a user has as well.

Last edited by Tallgeese (08-20-2009 07:28:50)


Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB