You are here

function ds_update_3000 in Display Suite 6.3

Implementation of hook_update_N

File

./ds.install, line 242
Display suite install file.

Code

function ds_update_3000(&$ret) {
  $ret = array();

  // Update displays
  $displays = array();
  $query = db_query("SELECT * FROM {ds_settings}");
  while ($result = db_fetch_array($query)) {
    $displays[] = $result;
  }
  db_drop_table($ret, 'ds_settings');

  // Create schema.
  $schema = ds_schema();
  foreach ($schema as $name => $spec) {
    db_create_table($ret, $name, $spec);
  }
  $notices = '';
  if (!empty($displays)) {
    module_load_include('php', 'ds', 'includes/dsDisplay');
    foreach ($displays as $d) {
      $ds = new dsDisplay();
      $ds->module = $d['module'];
      $ds->type = $d['type'];
      $ds->build_mode = $d['build_mode'];
      $ds->settings = unserialize($d['settings']);
      $ds->name = ds_machine_name(array(
        $d['module'],
        $d['type'],
        $d['build_mode'],
      ));
      $ds
        ->save();
      $notices = "Updated " . $d['build_mode'] . "display for " . $d['type'] . " using module " . $d['module'] . "\n";
    }
  }
}