You are here

function date_update_6003 in Date 6.2

Update all repeating date delta values with the RRULE so we can use that info in Views when we pull individual items out in a query.

File

date/date.install, line 152

Code

function date_update_6003() {
  $ret = array();
  drupal_load('module', 'content');
  $fields = content_fields();
  foreach ($fields as $field) {
    if (strstr($field['type'], 'date') && !empty($field['repeat'])) {
      $db_info = content_database_info($field);
      $table = $db_info['table'];
      $column = $field['field_name'] . '_rrule';
      $result = db_query("SELECT DISTINCT nid, vid, {$column} FROM {" . $table . "} WHERE {$column} <> ''");
      while ($row = db_fetch_array($result)) {
        $ret[] = update_sql("UPDATE {" . $table . "} SET {$column}='" . $row[$column] . "' WHERE nid=" . $row['nid'] . " AND vid=" . $row['vid']);
      }
    }
  }
  return $ret;
}