6.0.0-beta1
7/17/25

[#7038] timezone and recurrence fixes for Kronolith's scheduler
Summary timezone and recurrence fixes for Kronolith's scheduler
Queue Kronolith
Queue Version 2.2
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester develop (at) kristov (dot) de
Created 07/06/2008 (6220 days ago)
Due
Updated 10/24/2008 (6110 days ago)
Assigned 10/14/2008 (6120 days ago)
Resolved 10/23/2008 (6111 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
10/24/2008 07:35:37 AM develop (at) kristov (dot) de Comment #4 Reply to this comment
Sorry for my late posting, I'm currently finishing my PhD thesis and 
there's quite a lot to do yet... Anyway, your fix works for me, thank 
you!
10/23/2008 11:06:40 PM Jan Schneider State ⇒ Resolved
 
10/14/2008 05:18:09 PM Jan Schneider Comment #3
State ⇒ Feedback
Taken from Horde DevelopersHorde Developers
Assigned to Jan Schneider
Reply to this comment
Tweaked and committed. Please test the version I checked in.
07/06/2008 10:42:22 PM Jan Schneider State ⇒ Assigned
Assigned to Horde DevelopersHorde Developers
Priority ⇒ 1. Low
 
07/06/2008 09:01:03 PM develop (at) kristov (dot) de Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ timezone and recurrence fixes for Kronolith's scheduler
Queue ⇒ Kronolith
Milestone ⇒
Patch ⇒ Yes
New Attachment: horde-kronolith-2.2-scheduler-1.patch Download
State ⇒ Unconfirmed
Reply to this comment
When the server and the Horde users use different timezones (in my 
case, UTC vs. Europe/Berlin), and the Kronolith scheduler is used 
(instead of the Horde Alarm system), strange things occur. In my case, 
many events were scheduled twice, once on time and once two hours 
later (the timezone difference between UTC and Europe/Berlin summer 
time). There also was an interaction with the agenda code which set 
the 'TZ' environment variable and inadvertantly changed the PHP's 
timezone for the following date calculations in the scheduler; as the 
agenda() function was not called every time, it was close to 
undeterminable when an event is scheduled correctly and when it is 
scheduled twice.



So I rewrote the scheduler in the spirit of the agenda function, i.e. 
I changed the outer and the inner loop of the scheduler: The outer 
loop iterates on the users, and the inner loop iterates on the events 
of the shares visible to the user. This allows to set the timezone for 
each user according to her stored preference before accessing the 
events.



The second problem the patches fixes is a bug introduced in rev. 1.55 
of lib/Scheduler/kronolith.php. As the revision comment correctly 
says, "Recurrence processing happens in listAlarms() now", so code was 
removed which handled recurrences via nextRecurrence() and 
hasException(). However, listAlarms() is called with fullevent==false, 
such that only the event *ids* and not the events (with corrected 
start/end time) are returned. So when the event is later retrieved via 
getEvent():



$event = $GLOBALS['kronolith_driver']->getEvent($eventId);



the recurrence corrections are gone. My solution simply reactivates 
the old correction code:



                             /* Set the event's start date to the next

                              * recurrence date. This should avoid problems

                              * when an alarm triggers on a different day from

                              * the actual event, and make $seenid unique for

                              * each occurrence of a recurring event. */

                             $event->start = 
$event->recurrence->nextRecurrence($this->_runtime);



                             /* Check for exceptions; do nothing if 
one is found. */

                             if 
($event->recurrence->hasException($event->start->year, 
$event->start->month, $event->start->mday)) {

                                 continue;

                             }



Another solution would be to rewrite this part of scheduler to use 
fullevent==true and to omit the getEvent() call. I can try that if you 
think that this would be the better solution.


Saved Queries