You are here

function ad_channel_update_6001 in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 channel/ad_channel.install \ad_channel_update_6001()
  2. 7 channel/ad_channel.install \ad_channel_update_6001()

Populate the ad_priority table.

File

channel/ad_channel.install, line 191

Code

function ad_channel_update_6001() {
  $ret = array();
  $result = db_query('SELECT a.aid, p.priority FROM {ads} a LEFT JOIN {ad_priority} p ON a.aid = p.aid');
  while ($ad = db_fetch_object($result)) {
    if (!isset($ad->priority)) {
      $ret[] = update_sql("INSERT INTO {ad_priority} (aid, priority) VALUES ({$ad->aid}, 0)");
    }
  }
  return $ret;
}