You are here

function linkchecker_schema in Link checker 7

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

Implements hook_schema().

File

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

Code

function linkchecker_schema() {
  $schema['linkchecker_block_custom'] = array(
    'description' => 'Stores all link references for custom blocks.',
    'fields' => array(
      'bid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {block_custom}.bid.',
      ),
      'lid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {linkchecker_link}.lid.',
      ),
    ),
    'primary key' => array(
      'bid',
      'lid',
    ),
    'foreign keys' => array(
      'bid' => array(
        'table' => 'block_custom',
        'columns' => array(
          'bid' => 'bid',
        ),
      ),
      'lid' => array(
        'table' => 'linkchecker_link',
        'columns' => array(
          'lid' => 'lid',
        ),
      ),
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  $schema['linkchecker_comment'] = array(
    'description' => 'Stores all link references for comments.',
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {comment}.cid.',
      ),
      'lid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique {linkchecker_link}.lid.',
      ),
    ),
    'primary key' => array(
      'cid',
      'lid',
    ),
    'foreign keys' => array(
      'cid' => array(
        'table' => 'comment',
        'columns' => array(
          'cid' => 'cid',
        ),
      ),
      'lid' => array(
        'table' => 'linkchecker_link',
        'columns' => array(
          'lid' => 'lid',
        ),
      ),
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  $schema['linkchecker_node'] = 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_link}.lid.',
      ),
    ),
    'primary key' => array(
      'nid',
      'lid',
    ),
    'foreign keys' => array(
      'nid' => array(
        'table' => 'node',
        'columns' => array(
          'nid' => 'nid',
        ),
      ),
      'lid' => array(
        'table' => 'linkchecker_link',
        'columns' => array(
          'lid' => 'lid',
        ),
      ),
    ),
    'indexes' => array(
      'lid' => array(
        'lid',
      ),
    ),
  );
  $schema['linkchecker_link'] = 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' => 64,
        'not null' => TRUE,
        'description' => 'The indexable hash of the {linkchecker_link}.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',
      ),
    ),
  );
  return $schema;
}