You are here

function boxes_update_6103 in Boxes 7

Same name and namespace in other branches
  1. 6 boxes.install \boxes_update_6103()

Ensure that Spaces overrides are stored as an object, not an array.

File

./boxes.install, line 181
Install, update and uninstall functions for the boxes module.

Code

function boxes_update_6103() {
  $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);
      $row->value = (object) $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.');
}