You are here

shrinktheweb.install in ShrinkTheWeb 6

Same filename and directory in other branches
  1. 8 shrinktheweb.install
  2. 7 shrinktheweb.install

File

shrinktheweb.install
View source
<?php

/**
 * Implementation of hook_schema().
 */
function shrinktheweb_schema() {
  $schema['shrinktheweb_log'] = array(
    'description' => 'Stores the STW requests',
    'fields' => array(
      'siteid' => array(
        'description' => '',
        'type' => 'serial',
        'unsigned' => TRUE,
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'domain' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'hash' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => '',
      ),
      'capturedon' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
      ),
      'quality' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 90,
      ),
      'full' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'xmax' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 200,
      ),
      'ymax' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 150,
      ),
      'nrx' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 1024,
      ),
      'nry' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 768,
      ),
      'invalid' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'stwerrcode' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '50',
        'not null' => TRUE,
      ),
      'error' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'errcode' => array(
        'description' => '',
        'type' => 'varchar',
        'length' => '50',
        'not null' => TRUE,
      ),
      'referrer' => array(
        'description' => '',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'siteid',
    ),
    'unique keys' => array(
      'hash' => array(
        'hash',
      ),
    ),
  );
  return $schema;
}

/**
 * This will update the shrinktheweb_log table to its new format
 */
function shrinktheweb_update_6100() {
  $schema = shrinktheweb_schema();
  db_drop_table($ret, 'shrinktheweb_log');
  db_create_table($ret, 'shrinktheweb_log', $schema['shrinktheweb_log']);
}

/**
* Implementation of hook_uninstall().
*/
function shrinktheweb_uninstall() {
  variable_del('shrinktheweb_access_key');
  variable_del('shrinktheweb_secret_key');
  variable_del('shrinktheweb_inside_pages');
  variable_del('shrinktheweb_thumb_size');
  variable_del('shrinktheweb_thumb_size_custom');
  variable_del('shrinktheweb_full_size');
  variable_del('shrinktheweb_max_height');
  variable_del('shrinktheweb_native_res');
  variable_del('shrinktheweb_widescreen_y');
  variable_del('shrinktheweb_delay');
  variable_del('shrinktheweb_quality');
  variable_del('shrinktheweb_cache_days');
  variable_del('shrinktheweb_thumbs_folder');
  variable_del('shrinktheweb_custom_msg_url');
  variable_del('shrinktheweb_debug');
}

Functions

Namesort descending Description
shrinktheweb_schema Implementation of hook_schema().
shrinktheweb_uninstall Implementation of hook_uninstall().
shrinktheweb_update_6100 This will update the shrinktheweb_log table to its new format