Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demeritcowboy/514a3c966f996f1d01270930b7cd0384 to your computer and use it in GitHub Desktop.
Save demeritcowboy/514a3c966f996f1d01270930b7cd0384 to your computer and use it in GitHub Desktop.

Skills/Prerequisites

  • Know how to set environment variables.
  • Upgrading the first time to 5.47.3 did not sufficiently fix your event times and you want more control over what the upgrade does.
  • As always before upgrading you should make a backup of your current database.

Environment variable

The environment variable is called CIVICRM_TZ_REVERT. It takes a comma-separated list of options (no spaces).

If using the UI upgrader, you should be able to set it in civicrm.settings.php using putenv('CIVICRM_TZ_REVERT=list,of,options');.

For command line upgrades, e.g. using cv, you would set it as any other environment variable, e.g. export CIVICRM_TZ_REVERT=list,of,options.

Options

  • backup
    • This controls whether to create backup fields in civicrm_event with the timestamp values before attempting to fix them.
    • The fields are: event_tz_bak, start_date_ts_bak, end_date_ts_bak, registration_start_date_ts_bak, registration_end_date_ts_bak
    • The default is to backup. Omit it from the list of options to skip.
  • revert
    • This controls whether to change the schema to revert the timestamp fields back to datetime.
    • The default is to revert. Omit it from the list of options to skip.
    • You might want to do this if it's causing errors for some reason and you want to try doing it manually yourself.
  • adapt
    • This controls whether to try to adjust the times for DST skew and other factors, attempting to put the correct values into the fields.
    • The default is to adapt. Omit it from the list of options to skip.
    • You might typically let it try to adapt, and then if it doesn't work you can restore from backup and run it without and see if that's better or worse.

Examples

  • export CIVICRM_TZ_REVERT=backup,revert,adapt
    • This is the same as the default. Do all of them.
  • export CIVICRM_TZ_REVERT=backup,revert
    • This would just backup and revert but not adapt.
  • export CIVICRM_TZ_REVERT=none
    • Since "blank" is the same as the default, to skip all the steps set it to some invalid value such as "none".

Incompatible variations

Note that adapt can not be run if backup was not run since it uses the backup fields, so CIVICRM_TZ_REVERT=revert,adapt and CIVICRM_TZ_REVERT=adapt will not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment