mod for fixing global unread flag problem

Discussion forum for MOD Writers regarding MOD Development.
Locked
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

mod for fixing global unread flag problem

Post by asinshesq »

phpbb3 has a bug that causes unread global announcements to lose their unread status whenever the user reads all the unreads in a given forum or posts any new posts or replies (see http://www.phpbb.com/bugs/phpbb3/15729 ).

I've been working on a fix that seems to work, but I have a feeling the developers had a good reason for not doing things this way and so I figured I'd post and ask. Here it is:

Code: Select all


Does this approach make sense?  It doesn't cost any additional queries so I wouldn't have thought this would wiegh down boards.
Last edited by asinshesq on Mon Dec 15, 2008 12:04 pm, edited 1 time in total.

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: mod for fixing global unread flag problem

Post by A_Jelly_Doughnut »

I haven't tried installing your MOD, but I'm not sure what would happen if there were two global announcements both receiving active discussion at any one time. I suspect your MOD would break down.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

A_Jelly_Doughnut wrote:I haven't tried installing your MOD, but I'm not sure what would happen if there were two global announcements both receiving active discussion at any one time. I suspect your MOD would break down.
I've been experimenting for a while with that and don't see any problem. ANd cocneptually I don't see why there would be a problem. Each regular forum only has one 'forum_last_post_time' and now so does globals (which you can think of as their own forum). And my other changes hopefully make the unread flag treatment of the globals 'forum' exactly the same as the unread flag treatment of a regular forum. So I think this should work but I will be interested in what happens in a real field trial (I am not running a live phpbb3 board so my testing is limited to a test board environment).

I was hoping to finish things up, but I see that the powers that be have just released 3.0.4 and that will set me back a fair bit.

I look forward to any input anyone may have on this approach.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

I complete fix will involve dealing with the following special cases:

- a user changes a nonglobal post to a global post or vice versa

- a user deletes a global post from posting.php

- a moderator deletes a topic from the mcp

- the sync() function is called

(Are there other special cases I am forgetting?)

I also need to replace any code I've written with analogous phpbb3 functions where appropriate (for example I can use set_config() rather than running the sql as part of the mod) and to generally clean up and shorten the code where possible (maybe by using separate functions so that I'm not cluttering up regular phpbb3 files so much).

I plan to try to perfect this over the next week (if I have the time), but that will take a lot of additional work and I don't want to waste time doing that if the developers are planning on working on a different solution. If they are, I sure would appreciate a pm letting me know so that I can stop spinning wheels. Thanks!

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

And while I stare further at this, am I correct that all deletions of topics (including when a regular user deletes his own post) runs through function delete_topics() in functions_admin.php?

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

This seems to work accross the board...I'll spend a bit more time testing this and then I'll post it in the development section, but again if the developers are already in the process of going down a different path on this please pm me and I'll stop working on it.

[edit: I deleted code because I have now posted a topic for this mod in the mod development section here: http://www.phpbb.com/community/viewtopi ... &t=1357705 . If you have any thoughts about this mod, please post in that topic rather than here]
Last edited by asinshesq on Mon Dec 15, 2008 2:52 pm, edited 2 times in total.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

Here's another potential issue:

When a topic gets moved from one forum to another, phpbb3 doesn't appear to have any code that deals with updating the unread tracking info. Depending on what the tracking info looks like for the destination forum versus the source forum, I would imagine that can result in a user's already read topic suddenly appearing unread when moved, or a user's unread topic suddenly appearing read when moved (or the status remaining correct, but that would just be coincidence).

I can't test that out right now since my host is down, but that's the way it appears to me after a quick look at the move and sync code. I got to thinking about this because there will be exactly the same problem when a regular post gets globalized or a global gets turned into a regular post.

I apologize if I jumped the gun on this and phpbb3 actually does deal with this scenario in a way I hadn't noticed. When my host is up again I will test and, if I am right, I will post a bug report.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

asinshesq wrote:Here's another potential issue:

When a topic gets moved from one forum to another, phpbb3 doesn't appear to have any code that deals with updating the unread tracking info. Depending on what the tracking info looks like for the destination forum versus the source forum, I would imagine that can result in a user's already read topic suddenly appearing unread when moved, or a user's unread topic suddenly appearing read when moved (or the status remaining correct, but that would just be coincidence).

I can't test that out right now since my host is down, but that's the way it appears to me after a quick look at the move and sync code...
My host is back up and I just tested this. I was correct that moving a topic or post to another place will mess up unread flag status. I will report this as a bug, but after thinking about it a bit I doubt there is a fix that would be efficient enough to be practical so long as phpbb3 sticks with a forums-based unread tracking system. (A fix would, I think, require code that would check individual flags for each and every user and update that user's forum_tracks and topics_tracks entries as appropriate for that user...which can be done but I think would drag down a board).

If phpbb3 were to move to a topics-based rather than forum-based unread tracking system (like ptirhiik's unread flags did for phpbb2), that would solve the problem for moved topics at the cost of some hit to efficiency (I don't have a feel for how much that hit would be).

[edit: I just reported this bug here: http://www.phpbb.com/bugs/phpbb3/ticket ... t_id=38885 ]
Last edited by asinshesq on Mon Dec 15, 2008 3:07 pm, edited 1 time in total.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: mod for fixing global unread flag problem

Post by asinshesq »

I just started a new topic for the mod to preserve globbal unread flags here: http://www.phpbb.com/community/viewtopi ... &t=1357705

If you have any thoughts on the mod, please post in that topic rather than here.

Locked

Return to “[3.0.x] MOD Writers Discussion”