17 Commits

Author SHA1 Message Date
Marina Glancy
b46badb130 MDL-70926 core: getuserdate() shoud show debugging if null was passed
passing null to getdate() has different results in PHP7 and PHP8
2021-05-06 19:55:32 +02:00
Simey Lameze
5b0282847e MDL-71156 core: machinery to recover orphaned calendar events
The machinery to fix orphaned calendar events that were broken by MDL-67494.

The solution consists of:

1) Upgrade step that checks if this site has executed the problematic upgrade steps and
   if positive, it will schedule a new run for calendar_fix_orphaned_events adhoc task.

2) Adhoc task that will self-spawn calling the recovery machinery, running until
   all the orphaned calendar events are fixed. It also sets the maximum runtime of
   60 seconds. It is also possible to override that number by specifing the desired
   number setting the ->calendareventsmaxseconds in your config.php

3) CLI script that will look for all the calendar events which userids
   where broken by a wrong upgrade step, affecting to Moodle 3.9.5
   and up.

   It performs checks to both:
     a) Detect if the site was affected (ran the wrong upgrade step).
     b) Look for orphaned calendar events, categorising them as:
       - standard: site / category / course / group / user events
       - subscription: events created via subscriptions.
       - action: normal action events, created to show common important dates.
       - override: user and group override events, particular, that some activities support.
       - custom: other events, not being any of the above, common or particular.

   By specifying it (--fix) try to recover as many broken events (missing userid) as
   possible. Standard, subscription, action, override events in core are fully supported but
   override or custom events should be fixed by each plugin as far as there isn't any standard
   API (plugin-wise) to launch a rebuild of the calendar events.

4) Unit tests and helper functions to generate calendar events. We have decided to
   keep the tests simple, testing only true and false and not using data generators because
   the code is purely to recover the calendar events and won't turn into an API or something
   and also due to the urgency of this issue.
   The helpers have been created in calendar/tests/helpers.php since there are no data generators
   for calendar.
2021-04-22 10:28:52 +08:00
Mikhail Golenkov
364d4caeec MDL-66716 calendar: Add usermidnight property for events. 2020-08-10 11:36:29 +10:00
Marina Glancy
1a972b06f1 MDL-58866 core_calendar: allow component events 2020-05-19 19:04:13 +02:00
Pau Ferrer Ocaña
375d82cafc MDL-66612 calendar: Change global events to site events
AMOS BEGIN
 CPY [category,moodle],[category,calendar]
 CPY [site,notes],[eventtypesite,calendar]
 CPY [site,moodle],[site,calendar]
 MOV [typesite,moodle],[siteevent,calendar]
AMOS END
2019-10-21 09:33:01 +02:00
Michael Hawkins
ef4e04ee26 MDL-37624 calendar: Added location support 2018-06-29 10:46:54 +08:00
Ryan Wyllie
4e0ac12efa MDL-60958 calendar: fix test helper action factory 2018-02-12 05:47:49 +00:00
Juan Leyva
44ae08383b MDL-60813 calendar: Fix core_calendar_get_calendar_events for categories
Users couldn’t see category events when filtering by categories in the
core_calendar_get_calendar_events WS.
2017-11-16 19:16:01 +01:00
Andrew Nicols
0085b0ea3c MDL-59890 calendar: Add support for the category to vault 2017-10-03 21:28:31 +08:00
Marina Glancy
47a710177a MDL-58688 calendar: retrieve event module without db queries 2017-05-04 16:53:19 +08:00
Cameron Ball
42e76c3f70 MDL-58430 core_calendar: Keep interfaces with implementations
All interfaces have been moved from the interfaces folder such
that they now live with their default implementations.

Part of MDL-55611 epic.
2017-04-04 11:01:55 +01:00
Mark Nelson
e1cd93ce20 MDL-58423 core_calendar: moved \core_calendar\event class
Part of MDL-55611 epic.
2017-04-04 11:01:49 +01:00
Jun Pataleta
20592f5ff2 MDL-58386 calendar: Fixed CI issues
Part of MDL-55611 epic.
2017-04-04 11:01:47 +01:00
Cameron Ball
bd01fd15d4 MDL-58087 core_calendar: Unit tests now jam with new vault behaviour
Some unit tests needed to be updated to specify a few extra
bits and pieces on the events to work properly with the
new event vault behaviour.

Part of MDL-55611 epic.
2017-04-04 11:01:41 +01:00
Cameron Ball
59a601e632 MDL-58087 core_calendar: Set correct ID for repeat event collection
Initially we were only sending "top level" events through our API
i.e., events that can be repeated, but are not repeats themselves.
In the future we will be sending ALL events through our API and int
that situation the ID of the collection needs a small bit of logic
to correctly set the ID of the parent.

Part of MDL-55611 epic.
2017-04-04 11:01:19 +01:00
Mark Nelson
c91b4c0278 MDL-57730 core_calendar: fixed failing unit tests
Part of MDL-55611 epic.
2017-04-03 11:36:33 +08:00
Ryan Wyllie
18a96325a7 MDL-57750 calendar: calendar event vault tests
Part of MDL-55611 epic.
2017-04-03 11:36:07 +08:00