You are here

function boxes_update_6101 in Boxes 6

Same name and namespace in other branches
  1. 7 boxes.install \boxes_update_6101()

If Spaces is installed update existing spaces overrides.

File

./boxes.install, line 110

Code

function boxes_update_6101() {
  $ret = array();
  if (module_exists('spaces')) {
    $result = db_query("SELECT * FROM {spaces_overrides} WHERE 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',
    );
  }
  return $ret;
}