You are here

function party_hat_update_7005 in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_hat/party_hat.install \party_hat_update_7005()

Filter out unused data sets in hat entity data.

File

modules/party_hat/party_hat.install, line 287
Contains install hooks for the party hat module..

Code

function party_hat_update_7005() {
  $party_hats = db_select('party_hat', 'ph')
    ->fields('ph', array(
    'hid',
    'data',
  ))
    ->execute()
    ->fetchAllAssoc('hid');
  foreach ($party_hats as $hid => $hat) {
    $hat->data = unserialize($hat->data);
    $values = $hat->data['data_sets'];
    party_hat_set_data_set_rules($hat, $values);
    $hat->data = serialize($hat->data);
    db_update('party_hat', 'ph')
      ->fields(array(
      'data' => $hat->data,
    ))
      ->condition('hid', $hid)
      ->execute();
  }
}