function party_hat_update_7003 in Party 8.2
Same name and namespace in other branches
- 7 modules/party_hat/party_hat.install \party_hat_update_7003()
Remove party types data from hats.
File
- modules/
party_hat/ party_hat.install, line 223 - Contains install hooks for the party hat module..
Code
function party_hat_update_7003() {
// Get all the hats.
$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);
unset($hat->data['party_types']);
$hat->data = serialize($hat->data);
// Update the record.
db_update('party_hat')
->fields(array(
'data' => $hat->data,
))
->condition('hid', $hid)
->execute();
}
}