You are here

function date_update_5206 in Date 5.2

Granularity options were not saved correctly by CCK if created using checkboxes. Checkboxes have been changed back to a select and we need to fix the values stored in the settings.

The bad values would have been stored in the form array( 'year' => 'year' 'month' => 'month', 'day' => 0, 'hour' => 0, 'minute' => 0, 'second' => 0, );

Good values would have been stored in the form array( 'year' => 'year', 'month' => 'month', );

Return value

unknown

File

date/date.install, line 456

Code

function date_update_5206() {
  $ret = array();
  $result = db_query("SELECT field_name, global_settings from {node_field} where type LIKE 'date_%'");
  while ($field = db_fetch_array($result)) {

    // Change the format to one date_popup can use.
    $field_settings = unserialize($field['global_settings']);
    $granularity = array_filter($field_settings['granularity']);
    $field_settings['granularity'] = $granularity;
    db_query("UPDATE {node_field} SET global_settings = '%s' WHERE field_name = '%s'", serialize($field_settings), $field['field_name']);
  }
  date_install_clear();
  return $ret;
}