Digests

Bug in version 3.2.11 affecting phpBB crons - Digests

Bug in version 3.2.11 affecting phpBB crons

by MarkDHamill » Thu Feb 14, 2019 12:46 am

I discovered a bug that affects lowly trafficked boards that uses the default phpBB cron method for sending digests. This method depends on board traffic to kick off the phpBB cron, which will then send any digests that need to be sent. It most typically affects those receiving daily digests. If there are no qualified posts in a daily digest for the 24 hours for the subscriber (usually because there were no forum posts at all for a 24 hour period), the first digest from a few days earlier go out but not the rest:

If you search the admin log for the subscriber's username (memberx in this case), the symptom looks like this:
A digests was NOT sent to memberx ([email protected]) for date 2019-2-12 and hour 19 UTC because one was sent to this subscriber earlier this hour.
A digests was NOT sent to memberx ([email protected]) for date 2019-2-11 and hour 19 UTC because one was sent to this subscriber earlier this hour.
A digests was NOT sent to memberx ([email protected]) for date 2019-2-10 and hour 19 UTC because one was sent to this subscriber earlier this hour.
A digests was NOT sent to memberx ([email protected]) for date 2019-2-9 and hour 19 UTC because one was sent to this subscriber earlier this hour.
A digest was sent to memberx ([email protected]) for date 2019-02-08 and hour 19 UTC containing 0 posts and 0 private messages
Note that these are read chronologically from the bottom up. In this case, the digest for 2019-02-08 goes out but digests from 2019-02-09 through 2019-02-12 do not.

Here's the line in error, line 555 in /ext/phpbbservices/digests/cron/task/digests.php:

Code: Select all

				if ($user_digest_last_sent['year'] == $now_info['year'] && $user_digest_last_sent['yday'] == $now_info['yday'] && $user_digest_last_sent['hours'] == $now_info['hours'])
Change to:

Code: Select all

				if ($hour == 0 && $user_digest_last_sent['year'] == $now_info['year'] && $user_digest_last_sent['yday'] == $now_info['yday'] && $user_digest_last_sent['hours'] == $now_info['hours'])
If you have correctly programmed a cron job using a system cron (so that it is executed at least hourly) or if you regularly get posts every day of the week, this error will not occur.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA