<?php

/**
 * @file
 * Install tasks.
 */

/**
 * Implements hook_install().
 */
function bassets_sw_schema() {
  $schema = array();
  $schema['cache_bassets'] = array(
    'description' => 'Caches raw files.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'A collection of data to cache.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'A Unix timestamp indicating when the cache entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'serialized' => array(
        'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'expire' => array('expire'),
    ),
    'primary key' => array('cid'),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function bassets_sw_uninstall() {
  variable_del('bassets_sw_base64_deliver');
}

/**
 * Implements hook_update_N().
 */
function bassets_sw_update_7001() {
  cache_clear_all(NULL, 'cache_bassets', '*');
}
