[pmwiki-users] Duplicate email notification

Patrick R. Michaud pmichaud at pobox.com
Wed Feb 13 12:07:48 CST 2008


On Wed, Feb 13, 2008 at 05:45:10PM +0000, Hans wrote:
> Wednesday, February 13, 2008, 5:30:21 PM, Patrick R. Michaud wrote:
> > This is probably the source of the difficulty -- NotifyUpdate
> > really doesn't expect to be called more than once in a given
> > session.  But if multiple pages are being updated via UpdatePage(),
> > then it would get reigstered multiple times and result in multiple
> > postings.  
> ...
> Randy's problem was that he got duplicates of the same notification.
> After a lengthy investigation we found that a change in notify.php
> would stop that behaviour:
> 
> changing this in notify.php:
> 
> ##   check if we need to do notifications
> if ($action != 'edit') NotifyCheck($pagename);
> 
> to this:
> 
> ##   check if we need to do notifications
> if ($action!='edit' && $action!='foxpost' && $action!='foxdelete'
>       && $action!='comment')
>          NotifyCheck($pagename);
> 
> Then Fox and Commentboxplus will not generate a NotifyCheck.
> and he had the problem of duplicates specifically with fox and
> commentboxplus postings, which use the actions included above.
> 
> Why his server's mailing system (or php or what) creates duplicates,
> but not my or other folks system, I don't know. The hack works, but
> the reason for the problem is not found yet.

Sure, the problem is exactly as I mentioned above:  NotifyUpdate
was being registered more than once -- one time as a result of
NotifyCheck (because $action!='edit'), and then again as a result
of UpdatePage.  However, since NotifyUpdate only checks $IsPagePosted
to determine if it needs to add a notification, and since $IsPagePosted
would be true as of the point where NotifyUpdate is called each time,
it would end up generating two separate notifications.

Thus, fixing notify.php so that NotifyUpdate is only invoked once,
and using an array of updated pages (instead of assuming that $pagename
is the page being updated) should go a long way to resolve this
particular problem.

Thanks!

Pm



More information about the pmwiki-users mailing list