function date_timezone_update_5200 in Date 5.2
Same name and namespace in other branches
- 6.2 date_timezone/date_timezone.install \date_timezone_update_5200()
- 6 date_timezone/date_timezone.install \date_timezone_update_5200()
Get rid of deprecated timezone names.
File
- date_timezone/
date_timezone.install, line 68 - Installation file for Date Timezone
Code
function date_timezone_update_5200() {
$ret = array();
$old = variable_get('date_default_timezone_name', NULL);
if (!empty($old)) {
$new = _date_timezone_replacement($old);
if (!empty($new) && $new != $old) {
variable_set('date_default_timezone_name', $new);
}
}
$results = db_query("SELECT DISTINCT timezone_name FROM {users} ORDER BY timezone_name");
while ($row = db_fetch_object($results)) {
if (!empty($row->timezone_name)) {
$new = _date_timezone_replacement($row->timezone_name);
if (!empty($new) && $new != $row->timezone_name) {
db_query("UPDATE {users} SET timezone_name = '%s' WHERE timezone_name = '%s'", $new, $row->timezone_name);
}
}
}
// Make sure the timezone name list gets updated.
cache_clear_all('date_timezone_identifiers_list', 'cache');
return $ret;
}