You are here

hosting_ssl.install in Hosting 7.3

Define the database schema and uninstall function for the hosting_ssl module.

File

web_server/ssl/hosting_ssl.install
View source
<?php

/**
 * @file
 * Define the database schema and uninstall function for the hosting_ssl module.
 *
 */

/**
 * Implements hook_schema().
 */
function hosting_ssl_schema() {
  $schema['hosting_ssl_server'] = array(
    'fields' => array(
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'ssl_port' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'vid',
      'nid',
    ),
  );
  $schema['hosting_ssl_cert'] = array(
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'ssl_key' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
      ),
      'client' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'indexes' => array(
      'ssl_key' => array(
        array(
          'ssl_key',
          50,
        ),
      ),
    ),
  );
  $schema['hosting_ssl_site'] = array(
    'fields' => array(
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'ssl_enabled' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'ssl_key' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'vid',
      'nid',
    ),
  );
  $schema['hosting_ssl_cert_ips'] = array(
    'fields' => array(
      // cert id
      'cid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      // reference to the hosting_ip_addresses table
      'ip_address' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'cid' => array(
        'cid',
      ),
      'ip_address' => array(
        'ip_address',
      ),
    ),
  );
  return $schema;
}

/**
 * Remove SSL service records from hosting_service table.
 */
function hosting_ssl_uninstall() {
  db_delete('hosting_service')
    ->condition('service', 'http')
    ->condition('type', 'apache_ssl')
    ->execute();
  db_delete('hosting_service')
    ->condition('service', 'http')
    ->condition('type', 'nginx_ssl')
    ->execute();
}

Functions

Namesort descending Description
hosting_ssl_schema Implements hook_schema().
hosting_ssl_uninstall Remove SSL service records from hosting_service table.