function weather_update_7202 in Weather 7.3
Same name and namespace in other branches
- 7.2 weather.install \weather_update_7202()
Convert old settings to new settings.
File
- ./
weather.install, line 693 - Install, update and uninstall functions for the weather module.
Code
function weather_update_7202(&$sandbox) {
$old_displays = db_query('SELECT * FROM {weather_display}');
foreach ($old_displays as $old_display) {
$units = unserialize($old_display->units);
$settings = unserialize($old_display->settings);
$config = array(
'temperature' => $units['temperature'],
'windspeed' => $units['windspeed'],
'pressure' => $units['pressure'],
'distance' => $units['distance'],
'show_sunrise_sunset' => array_key_exists('suninfo', $settings['data']),
'show_windchill_temperature' => $settings['show_apparent_temperature'],
'show_abbreviated_directions' => $settings['show_abbreviated_directions'],
'show_directions_degree' => $settings['show_directions_degree'],
);
db_insert('weather_displays')
->fields(array(
'type' => $old_display->type,
'number' => $old_display->number,
'config' => serialize($config),
))
->execute();
}
}