You are here

function date_update_6004 in Date 6.2

Empty the stored db for timezones that use timezone 'none'.

File

date/date.install, line 173

Code

function date_update_6004() {
  $ret = array();
  drupal_load('module', 'content');
  $fields = content_fields();
  foreach ($fields as $field) {
    if (strstr($field['type'], 'date') && !empty($field['tz_handling']) && $field['tz_handling'] == 'none') {
      $row = db_result(db_query("SELECT global_settings FROM {" . content_field_tablename() . "} WHERE field_name='" . $field['field_name'] . "'"));
      $settings = unserialize($row);
      $settings['timezone_db'] = '';
      $settings = serialize($settings);
      db_query("UPDATE {" . content_field_tablename() . "} SET global_settings='%s' WHERE field_name='%s'", $settings, $field['field_name']);
    }
  }
  drupal_set_message(t("The database has been updated to correct the stored timezone for fields using timezone 'none'."));
  content_clear_type_cache();
  return $ret;
}