You are here

function _messaging_update_duplicate_destinations in Messaging 6.4

Reusable update, delete duplicate destinations

1 call to _messaging_update_duplicate_destinations()
messaging_update_6011 in ./messaging.install
Delete duplicated destinations

File

./messaging.install, line 437

Code

function _messaging_update_duplicate_destinations() {
  $ret = array();

  // Mark all rows that have a previous with the same type, address
  $ret[] = update_sql("UPDATE {messaging_destination} d INNER JOIN {messaging_destination} d2 ON d.uid = d2.uid AND d.address = d2.address AND d.type = d2.type AND d.mdid > d2.mdid SET d.type = ''");

  // Now delete marked rows
  $ret[] = update_sql("DELETE FROM messaging_destination WHERE type = ''");
  return $ret;
}