Extension:CampaignEvents

API
See /Api for the list of API endpoints provided by this extension.

Script to update timezones
The extension stores the local time and timezone for each event, to guarantee that the local time remains accurate even if time zone rules change. However,internally it also stores UTC timestamps so that certain operations like sorting are possible; you can read more details in T314871. The UTC timestamps may go out of sync with the local ones if time zone rules change, which happens more commonly than you may think (see more information on the same task). In order to mitigate that, the extension provides a [ https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/CampaignEvents/+/refs/heads/master/maintenance/UpdateUTCTimestamps.php maintenance script] that recomputes the UTC timestamps for all events according to the latest timezone rules, and stores them back into the database.

In order for this to work, you have to make sure that PHP has access to the latest version of the tz database. The PHP manual [ https://www.php.net/manual/en/function.timezone-version-get.php provides] some context about this. The easiest solution is to install the [ https://pecl.php.net/package/timezonedb timezonedb] PECL package and make sure to keep it up-to-date.

Assuming that PHP has access to the latest timezone rules, you can run the script with:

The script also takes an optional parameter where you can specify the name of a time zone whose rules changed; this parameter can be repeated multiple times. If passed, the script will only update events whose timezone matches one of the timezones specified via this parameter.

If you upgrade the time zone database automatically (e.g., with a cronjob), you can make that job also execute this script, so that you don't have to do it manually every time you upgrade the time zone database.