You are here

function linkchecker_schema in Link checker 6.2

Same name and namespace in other branches
  1. 8 linkchecker.install \linkchecker_schema()
  2. 7 linkchecker.install \linkchecker_schema()

Implementation of hook_schema().

File

./linkchecker.install, line 61
Installation file for Link Checker module.

Code

function linkchecker_schema() {
  $schema['linkchecker_links'] = array(
    'description' => 'Stores all links.',
    'fields' => array(
      'lid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique link ID.',
      ),
      'urlhash' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'description' => 'The indexable md5 hash of the {linkchecker_links}.url.',
      ),
      'url' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'The full qualified link.',
      ),
      'method' => array(
        'type' => 'varchar',
        'length' => 4,
        'default' => 'HEAD',
        'not null' => TRUE,
        'description' => 'The method for checking links (HEAD, GET, POST).',
      ),
      'code' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => -1,
        'description' => 'HTTP status code from link checking.',
      ),
      'error' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'The error message received from the remote server while doing link checking.',
      ),
      'fail_count' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Fail count of unsuccessful link checks. No flapping detection. (Successful = 0, Unsuccessful = fail_count+1).',
      ),
      'last_checked' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp of the last link check.',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'description' => 'Boolean indicating if a link should be checked or not.',
      ),
    ),
    'primary key' => array(
      'lid',
    ),
    'unique keys' => array(
      'urlhash' => array(
        'urlhash',
      ),
    ),
    'indexes' => array(
      'method' => array(
        'method',
      ),
      'code' => array(
        'code',
      ),
      'fail_count' => array(
        'fail_count',
      ),
      'last_checked' => array(
        'last_checked',
      ),
      'status' => array(
        'status',
      ),
    ),
  );
  $schema['linkchecker_boxes'] = array(
    'description' => 'Stores all link references for boxes.',
    'fields' => array(
      'bid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {boxes}.bid.',
      ),
      'lid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {linkchecker_links}.lid.',
      ),
    ),
    'primary key' => array(
      'bid',
      'lid',
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  $schema['linkchecker_nodes'] = array(
    'description' => 'Stores all link references for nodes.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {node}.nid.',
      ),
      'lid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {linkchecker_links}.lid.',
      ),
    ),
    'primary key' => array(
      'nid',
      'lid',
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  $schema['linkchecker_comments'] = array(
    'description' => 'Stores all link references for comments.',
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {comments}.cid.',
      ),
      'lid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {linkchecker_links}.lid.',
      ),
    ),
    'primary key' => array(
      'cid',
      'lid',
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  return $schema;
}