Because of a UPDATE-Query missing in advanced_forum_markasread(), markasread did not work propperly (Nodes allready present in {history} were not updated to current timestamp).
Instead of setting an additional UPDATE-Query, I added a DELETE before the INSERT. Because UPDATE seems to bring performance to its knees. Besides so only nodes are saved, that are within the NODE_NEW_LIMIT-tolerance, so {history} stays smaller, i guess.
Patch attached (on alpha12).
| Comment | File | Size | Author |
|---|---|---|---|
| advanced_forum_markasread_alpha12.patch | 3.24 KB | derhasi |
Comments
Comment #1
michelleCould you define "not work properly"? I use it all the time on my site to mark everything read for UID 1 since I read them with my normal account. I've never had a problem with it. Is this a postgres problem?
Michelle
Comment #2
derhasi commentedIt's not a postgres poblem. I'm using MySQL.
The problem is, that users and me could not mark content as read. So I looked at your queries and recognized, that existing nids in history were not updated to the current timestamp, but that has to be done, for marking them as read. They were not updated, because there is only an INSERT for nodes that do not exist in {history} for the given user.
So the problem is, that once a node (of a given user) is in {history} it can't be set as read by markasread. So it would only work, for threads that were never visited by the user.
Comment #3
michelleAhhhh, I see. Since I never actually read them with that account, that's why it works. I didn't write this code and I guess I never looked that close at it. Now that I look at it, you're right, of course. I'll get this into the next alpha. Setting RTBC just taking your word for it. I'll test it myself before I commit it.
Thanks!
Michelle
Comment #4
swill commentedI have tested this patch. It seems to work, but it is not without some minor issues...
When I test it for a specific forum
it works fine without any issues (that i have found yet).
However if you do "Mark All Read" for all of the forum (aka on the front page of the forum)
I get the following user warnings (with different numbers) every time I do it. I have done a bit of testing and it seems to happen all the time in that case. Here is the warning...
user warning: Duplicate entry '1-82658' for key 1 query: INSERT INTO history (uid,nid,timestamp) SELECT 1, n.nid, 1224177392 FROM node AS n INNER JOIN term_node AS tn ON n.nid=tn.nid INNER JOIN node_comment_statistics AS ncs ON ncs.nid=n.nid INNER JOIN term_data AS td ON tn.tid=td.tid WHERE (n.created > 1221585392 OR ncs.last_comment_timestamp > 1221585392) AND td.vid = 1 in /var/www/includes/database.mysql.inc on line 172.
Let me know if you have suggestions...
Comment #5
derhasi commentedmaybe we have to add a
DISTINCTto theSELECT ...? That could be because of nodes that have associated two or more terms of the forums' vocabulary.Comment #6
swill commentedthat seemed to fix the problem. thanks for the quick response derhasi...
this is the query that is working for me.
cheer...
Comment #7
michelleThanks, guys, for getting this fixed up. I fixed the formatting and a some missed "AS"s and committed it to the D5 branch. I still need to port it to D6 but my dev site is hosed so it will have to wait a bit.
Michelle
Comment #8
michelleCommitted to 6.x.
Michelle
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.