You are here

hosting_ssl.install in Hosting 6.2

File

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

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;
}
function hosting_ssl_install() {
  drupal_install_schema('hosting_ssl');
}
function hosting_ssl_uninstall() {
  db_query("DELETE FROM {hosting_service} WHERE service='http' and type='apache_ssl'");
  db_query("DELETE FROM {hosting_service} WHERE service='http' and type='nginx_ssl'");
  drupal_uninstall_schema('hosting_ssl');
}