You are here

contentanalysis.install in Content Analysis 6

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

Install include file. Implements database schema.

File

contentanalysis.install
View source
<?php

/**
 * @file
 * Install include file. Implements database schema.
 */

/**
 *  Implementation of hook_install().
 */
function contentanalysis_install() {
  drupal_install_schema('contentanalysis');
  drupal_set_message(st('Content Analysis has been installed.'));
}

/**
 * Implementation of hook_uninstall().
 */
function contentanalysis_uninstall() {
  drupal_uninstall_schema('contentanalysis');
  drupal_set_message(st('Content Analysis has been uninstalled.'));
}

/**
 *  Implementation of hook_schema()
 */
function contentanalysis_schema() {
  $schema['contentanalysis'] = array(
    'description' => t('Creates database table for content analysis settings.'),
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The id for the analysis.',
      ),
      //aid
      'last_analysis' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The unix timestamp of the time the analysis was last run.',
      ),
      //last_analysis
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid of an analyzed node.',
      ),
      //nid
      'path' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Drupal path of an analyzed page.',
      ),
      //path
      'url' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'URL of an analyzed page.',
      ),
      //url
      'analyzers' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Analyzers to use with node.',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'path' => array(
        'path',
      ),
      'url' => array(
        'url',
      ),
    ),
  );
  return $schema;
}

/*
CREATE TABLE IF NOT EXISTS `contentanalysis` (
  `aid` int(10) unsigned NOT NULL auto_increment,
  `last_analysis` int(11) NOT NULL default '0',
  `nid` int(10) unsigned NOT NULL default '0',
  `path` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `analyzers` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`aid`),
  KEY `nid` (`nid`),
  KEY `path` (`path`),
  KEY `url` (`url`)
)
*/

Functions

Namesort descending Description
contentanalysis_install Implementation of hook_install().
contentanalysis_schema Implementation of hook_schema()
contentanalysis_uninstall Implementation of hook_uninstall().