You are here

function ultimate_cron_update_6105 in Ultimate Cron 6

Add missing index to database

File

./ultimate_cron.install, line 266
Installation file for Ultimate Cron

Code

function ultimate_cron_update_6105() {
  $result = db_query("SELECT fid, `function` FROM {ultimate_cron} ORDER BY fid ASC");
  $fids = array();
  $keep = array();
  $ret = array();
  while ($item = db_fetch_array($result)) {
    if (isset($keep[$item['function']])) {
      $fids[] = $keep[$item['function']];
    }
    $keep[$item['function']] = $item['fid'];
  }
  if ($fids) {
    db_query("DELETE FROM {ultimate_cron} WHERE fid IN (" . db_placeholders($fids) . ")", $fids);
  }
  db_add_unique_key($ret, 'ultimate_cron', 'uniq_function', array(
    'function',
  ));
  return $ret;
}