function date_update_5204 in Date 5.2
Same name and namespace in other branches
- 6 date/date.install \date_update_5204()
Get rid of deprecated timezone names.
File
- date/
date.install, line 392
Code
function date_update_5204() {
$ret = array();
drupal_load('module', 'content');
$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 != $old) {
db_query("UPDATE {$table} SET {$column} = '%s' WHERE {$column} = '%s'", $new, $row->timezone_name);
}
}
}
}
}
return $ret;
}