You are here

function mass_contact_update_7101 in Mass Contact 7

Move mass_contact.recipients database field to serialized data.

File

./mass_contact.install, line 343
Install, update and uninstall functions for the Mass Contact module.

Code

function mass_contact_update_7101(&$sandbox) {
  $records = db_query('SELECT cid, recipients FROM {mass_contact}');
  foreach ($records as $record) {
    $recipients = serialize(array(
      'mass_contact_role' => explode(',', $record->recipients),
    ));
    db_query('UPDATE {mass_contact} SET recipients = :recipients WHERE cid = :cid', array(
      ':cid' => $record->cid,
      ':recipients' => $recipients,
    ));
  }
}