You are here

function dfp_update_7001 in Doubleclick for Publishers (DFP) 7

Same name and namespace in other branches
  1. 7.2 dfp.install \dfp_update_7001()

The network id is now included automatically in the ad unit pattern therefore existing tags need the ad unit id token removed so it doesnt appear twice.

File

./dfp.install, line 253
Installation file for DFP module.

Code

function dfp_update_7001() {
  $t = get_t();
  $tags = db_select('dfp_tags', 'd')
    ->fields('d')
    ->execute();
  foreach ($tags as $tag) {
    if (strpos($tag->adunit, '[dfp_tag:network_id]/') === 0) {
      $tag->adunit = str_replace('[dfp_tag:network_id]/', '', $tag->adunit);
      $record = array(
        'adid' => $tag->adid,
        'adunit' => $tag->adunit,
      );
      drupal_write_record('dfp_tags', $record, 'adid');
    }
  }
  return $t('The [dfp_tag:network_id] token has been removed from the beginning of the Ad Unit Pattern for all tags because it is now automatically included.');
}