I have created a PHP script to read an ical file from my mailserver. This script is used to plan events in my PBX so when people call and I'm out of office it automatically redirects them to voicemail. This works perfectly for one time events, but I would like it to work for recurring events.
This is the result of the script:
[BEGIN] => VEVENT
[DTSTAMP] => 20170920T120736Z
[UID] => 80462778A326E04EBD831336D01F2A2F179EBCBCC8BD7A45954DE9CF
[DESCRIPTION] => \n
[PRIORITY] => 5
[SUMMARY] => Summary
[CLASS] => PUBLIC
[LOCATION] => Place
[X-ALARM-TRIGGER] => -PT30M
[DTSTART] => 20170912T083000
[DTEND] => 20170912T173000
[RRULE] => FREQ=WEEKLY;BYDAY=TU
[END] => VEVENT
I can recognize a recurring event by the "RRULE" parameter, but thinking it through the script would have to calculate the recurring date and that would take a lot of CPU I guess. Especially since my ical file already has over 1800 events and these would all have to be checked. Then there is also the question on how to check this, because recurring events can be daily, weekly, monthly, yearly, and that is without intervals, e.g. every other week.
Any idea on how to go about this?