function date_update_5204 in Date 6
Same name and namespace in other branches
- 5.2 date/date.install \date_update_5204()
Get rid of deprecated timezone names.
File
- date/
date.install, line 281
Code
function date_update_5204() {
date_install_load();
$ret = array();
$fields = content_fields();
foreach ($fields as $field) {
if (($field['type'] == 'date' || $field['type'] == 'datestamp') && $field['tz_handling'] == 'date') {
$db_info = content_database_info($field);
$table = $db_info['table'];
$column = $db_info['columns']['timezone']['column'];
$results = db_query("SELECT DISTINCT {$column} FROM {$table} ORDER BY {$column}");
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 {$table} SET {$column} = '%s' WHERE {$column} = '%s'", $new, $row->timezone_name);
}
}
}
}
}
return $ret;
}