You are here

contentanalysis.install in Content Analysis 7

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

Install include file. Implements database schema.

File

contentanalysis.install
View source
<?php

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

/*
 * Implements hook_schema().
 */
function contentanalysis_schema() {
  $schema['contentanalysis'] = array(
    'description' => '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',
      ),
    ),
  );
  $schema['contentanalysis_status'] = array(
    'description' => 'Creates database table for content analysis settings.',
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The id for the analysis.',
      ),
      //aid
      'analyzer' => array(
        'type' => 'varchar',
        'length' => '64',
        'not null' => TRUE,
        'default' => '',
        'description' => 'Analyzer id reporting the status.',
      ),
      //analyzer
      'status' => array(
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'default' => '',
        'description' => 'text status.',
      ),
      //url
      'statusi' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'Integer id of status',
      ),
      //statusi
      'score' => array(
        'type' => 'float',
        'description' => 'Report score',
      ),
    ),
    'primary key' => array(
      'aid',
      'analyzer',
    ),
  );
  return $schema;
}

/**
 * Fix wrong access permissions(#1757628).
 */
function contentanalysis_update_7000() {
  $roles = user_roles(TRUE, 'access administration pages');
  foreach ($roles as $rid => $role) {
    user_role_grant_permissions($rid, array(
      'administer content analysis',
    ));
  }
}

Functions

Namesort descending Description
contentanalysis_schema
contentanalysis_update_7000 Fix wrong access permissions(#1757628).