You are here

sexybookmarks.install in Share Buttons, Related Posts, Content Analytics - Shareaholic 7

Same filename and directory in other branches
  1. 7.2 sexybookmarks.install

Install, update and uninstall functions for the SexyBookmarks module.

File

sexybookmarks.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the SexyBookmarks module.
 */

/**
 * Implements hook_schema().
 */
function sexybookmarks_schema() {
  $schema = array();
  $schema['sexybookmarks_profiles'] = array(
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'name',
      'identifier' => 'profile',
      'default hook' => 'default_sexybookmarks_profile',
      'api' => array(
        'owner' => 'sexybookmarks',
        'api' => 'default_sexybookmarks_profiles',
        'minimum_version' => 2,
        'current_version' => 2,
      ),
    ),
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => '',
      ),
      'config' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
        'serialize' => TRUE,
        'description' => '',
      ),
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function sexybookmarks_uninstall() {
  db_delete('variable')
    ->condition('name', '%' . db_like('sexybookmarks') . '%', 'LIKE')
    ->execute();
}

/**
 * Add 'sexybookmarks_profiles' database table.
 */
function sexybookmarks_update_6200(&$sandbox) {
  if (!db_table_exists('sexybookmarks_profiles')) {
    db_create_table('sexybookmarks_profiles', array(
      'fields' => array(
        'name' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
          'description' => '',
        ),
        'config' => array(
          'type' => 'text',
          'size' => 'medium',
          'not null' => TRUE,
          'serialize' => TRUE,
          'description' => '',
        ),
      ),
      'unique keys' => array(
        'name' => array(
          'name',
        ),
      ),
      'primary key' => array(
        'name',
      ),
    ));
    variable_del('sexybookmarks');
    return t('Added SexyBookmarks profile table.');
  }
}

/**
 * Update block cache type.
 */
function sexybookmarks_update_7200() {
  db_update('block')
    ->fields(array(
    'cache' => -1,
  ))
    ->condition('module', 'sexybookmarks')
    ->execute();
  return t('Updated Block cache type.');
}

Functions

Namesort descending Description
sexybookmarks_schema Implements hook_schema().
sexybookmarks_uninstall Implements hook_uninstall().
sexybookmarks_update_6200 Add 'sexybookmarks_profiles' database table.
sexybookmarks_update_7200 Update block cache type.