You are here

development_environment.install in Development Environment 7

Same filename and directory in other branches
  1. 8 development_environment.install

Holds installation hooks for the Development Environment module.

File

development_environment.install
View source
<?php

/**
 * @file
 * Holds installation hooks for the Development Environment module.
 */

/**
 * Implements hook_enable().
 */
function development_environment_enable() {
  $useful_modules = array(
    'simpletest',
    'coder',
    'coder_review',
    'diff',
    'xhprof',
  );
  foreach ($useful_modules as $module) {
    if (module_exists($module)) {
      module_enable($module);
    }
  }
}

/**
 * Implements hook_schema().
 */
function development_environment_schema() {
  $schema['development_environment_log'] = [
    'description' => 'Email logs stored by the development environment module',
    'fields' => [
      'lid' => [
        'description' => 'The unique Log ID of the log item',
        'type' => 'serial',
      ],
      'email_data' => [
        'description' => 'The Drupal email data',
        'type' => 'text',
        'not null' => TRUE,
      ],
      'timestamp' => [
        'description' => 'The UNIX timestamp at which the email was logged',
        'type' => 'int',
        'length' => 10,
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      'recipient_email' => [
        'description' => 'The recipient of the email',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
      'subject' => [
        'description' => 'The subject of the email',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'lid',
    ],
  ];
  return $schema;
}

/**
 * Creates the {development_environment_log} table in the database.
 */
function development_environment_update_7101() {
  db_create_table('development_environment_log', [
    'description' => 'Email logs stored by the development environment module',
    'fields' => [
      'lid' => [
        'description' => 'The unique Log ID of the log item',
        'type' => 'serial',
      ],
      'email_data' => [
        'description' => 'The Drupal email data',
        'type' => 'text',
        'not null' => TRUE,
      ],
      'timestamp' => [
        'description' => 'The UNIX timestamp at which the email was logged',
        'type' => 'int',
        'length' => 10,
        'not null' => TRUE,
        'unsigned' => TRUE,
      ],
      'recipient_email' => [
        'description' => 'The recipient of the email',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
      'subject' => [
        'description' => 'The subject of the email',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'lid',
    ],
  ]);
}

Functions

Namesort descending Description
development_environment_enable Implements hook_enable().
development_environment_schema Implements hook_schema().
development_environment_update_7101 Creates the {development_environment_log} table in the database.