You are here

function node_gallery_update_6102 in Node Gallery 6.2

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

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

File

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

Code

function node_gallery_update_6102() {
  $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->teaser['gallery_display_type'] == '0') {
        $relationship->teaser['gallery_display_type'] = 'cover';
      }
      elseif ($relationship->teaser['gallery_display_type'] == '1') {
        $relationship->teaser['gallery_display_type'] = 'thumbnails';
      }
      $relationship->gallery = array(
        'gallery_display' => 'thumbnails',
        'lightbox2_gallery_preset' => 'node-gallery-display',
      );
      unset($relationship->data);
      $relationship
        ->save();
    }
  }
  return $ret;
}