You are here

function event_update_5 in Event 5.2

Set DST

File

./event.install, line 276

Code

function event_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'pgsql':
      db_add_column($ret, 'event_timezones', 'is_dst', 'integer', array(
        'default' => 0,
        'not null' => TRUE,
      ));
      break;
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {event_timezones} ADD is_dst int NOT NULL default 0");
      break;
  }
  $time = _event_user_time();

  // Loop over the 21 supported DST regions.
  for ($i = 0; $i <= 20; $i++) {
    $is_dst = event_is_dst($i, $time);
    $ret[] = update_sql("UPDATE {event_timezones} SET is_dst = {$is_dst} WHERE dst_region = {$i}");
  }
  return $ret;
}