When using day of the week in the cron rule you can get an incorrect timestamp for when the cronjob will run next.
Repoduce bug:

// Let elysia cron determine the next time our rule will run. Note that last run contains the timestamp for 26.06.2012 5:00:00.
$next_run = _elysia_cron_next_run(array('rule' => '0 5 * * 2', 'last_run' => 1340686800));
// This will output "02.07.2012 5:00:00" instead of "03.07.2012 5:00:00".
echo date('d.m.Y H:i:s', $next_run);

This issue only happens during a month transition where the number of days in the month is less then 31.

The following fix solves this issue (will create patch soon...):

// elysia_cron_scheduler.inc:142 -> change $range_to to 31.
$r1['n'] = array_merge($r1['n'], __cronMonDaysFromWeekDays($year, $month, $r2['n']), __cronMonDaysFromWeekDays($year, $month + 1, $r2['n'], 31));

Comments

m.mahner’s picture

Same issue with the 7.x-2.x branch.

I'm not sure about how to handle this - should I open another issue on the 7.x-2.x tracker? Or just set the version of this issue to none?

freblasty’s picture

Created patch for the 6.x-2.x branch.

gotheric’s picture

Assigned: Unassigned » gotheric
Status: Active » Fixed

Thank your for the issue and patch.

I've commited it in last DEV release (it will go in STABLE branch in about month, i think).

WARNING ABOUT NEW DEV VERSION:
This has a lot of refactoring in internal APIs and should NOT be used in production sites (or do that at your own risk). I've tested it a little, but it's under construction yet so i don't assure every use case works.
It's only for D7 (i'll sync the D6 version only at the end of the development of the D7 one)
Changes:
- A lot of internal API improvements
- Completely rewritten Drush support, with a lot of features (and several to come). Now "drush cron" (or "drush core-cron") works as expected, and has several options.
See "drush help elysia-cron" for them.
- Better support for Drupal queues
- More to come (i think this will become a "2.5" version)

freblasty’s picture

To which branch has the patch been commited?

gotheric’s picture

You can find it in "Development releases", but Drupal build system rebuild it only once a day, so you should wait that release date will update.
(Or you can checkout from GIT, if you're really in need)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.