You are here

function node_gallery_update_6101 in Node Gallery 6

Same name and namespace in other branches
  1. 6.3 node_gallery.install \node_gallery_update_6101()
  2. 6.2 node_gallery.install \node_gallery_update_6101()

Implementation of hook_update_N() Updating the database for the changing options for "view original"

File

./node_gallery.install, line 306
Node gallery install file.

Code

function node_gallery_update_6101() {
  $ret = array();
  $result = db_query("SELECT * FROM {ng_gallery_config} WHERE 1");
  $t = drupal_unpack(db_fetch_object($result));
  while ($t = drupal_unpack(db_fetch_object($result))) {
    if (!empty($t)) {
      $relationship = new gallery_config($t);
      if (!$relationship->lightbox2) {
        $relationship->lightbox2 = 'node-gallery-display';
      }
      if (!$relationship->view_original_text) {
        $relationship->view_original_text = '';
      }
      if ($relationship->view_original == '1') {
        $relationship->view_original = 'default';
      }
      unset($relationship->data);
      $relationship
        ->save();
    }
  }
  return $ret;
}