function boxes_update_6101 in Boxes 7
Same name and namespace in other branches
- 6 boxes.install \boxes_update_6101()
If Spaces is installed update existing spaces overrides.
File
- ./
boxes.install, line 123 - Install, update and uninstall functions for the boxes module.
Code
function boxes_update_6101() {
$ret = array();
if (module_exists('spaces')) {
$result = db_query("SELECT * FROM {spaces_overrides} WHERE object_type = :object_type", array(
':object_type' => 'boxes',
));
while ($row = db_fetch_object($result)) {
$v = unserialize($row->value);
$v->plugin_key = 'simple';
$v->options = array(
'body' => $v->body,
'format' => $v->format,
);
unset($v->body);
unset($v->format);
$row->value = (array) $v;
drupal_write_record('spaces_overrides', $row, array(
'type',
'id',
'object_type',
'object_id',
));
}
$ret[] = array(
'success' => TRUE,
'query' => 'Updated Spaces overrides',
);
}
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.');
}