You are here

function gallery_assist_update_4 in Gallery Assist 6

Implementation of hook_update_N().

File

./gallery_assist.install, line 738
Install, update and uninstall functions and DB tables for the Gallery Assist module.

Code

function gallery_assist_update_4() {
  $ret = array();
  $schema['gallery_assist_modules_settings'] = array(
    'description' => 'Table to manage setting from gallery assist submodules.',
    'fields' => array(
      'gam' => array(
        'description' => 'The primary identifier for setting entries.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'The primary identifier from the node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'ref' => array(
        'description' => 'The reference ID from the node, used by translations.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'gid' => array(
        'description' => 'The gallery ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'gref' => array(
        'description' => 'The reference ID from the gallery, used by translations.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'module' => array(
        'description' => 'The modules settings data.',
        'type' => 'varchar',
        'length' => 150,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'The modules settings data.',
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'gam',
    ),
  );
  db_create_table($ret, 'gallery_assist_modules_settings', $schema['gallery_assist_modules_settings']);

  // Add the missing default params for ordering of gallery items by load from the DB.
  $check['default'] = variable_get('gallery_assist_default_data', FALSE);
  $check['default']['ga_db_order_field'] = 'a.weight';
  $check['default']['ga_db_order'] = 'ASC';
  variable_set('gallery_assist_' . $v->type, $check['default']);

  // Add the missing assignment params for ordering of gallery items by load from the DB.
  $types = node_get_types();
  foreach ($types as $v) {
    if (variable_get('gallery_assist_' . $v->type, 0) == 1) {
      $check[$v->type] = variable_get('gallery_assist_' . $v->type . '_data', FALSE);
      $check[$v->type]['ga_db_order_field'] = 'a.weight';
      $check[$v->type]['ga_db_order'] = 'ASC';
      variable_set('gallery_assist_' . $v->type . '_data', $check[$v->type]);
    }
  }
  gallery_assist_clearthecache();
  return $ret;
}