You are here

function hosting_server_update_6201 in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 server/hosting_server.install \hosting_server_update_6201()
  2. 7.4 server/hosting_server.install \hosting_server_update_6201()

Implements hook_update_N().

Create SSL cert to IP mapping table.

We create the SSL cert to IP mapping table here instead of in the ssl module as we need to cleanup the ip_address table after and we can't sync across modules. Since this module is a dependency of hosting_site_ssl, this is not a problem.

If SSL is not installed, this is a noop.

File

server/hosting_server.install, line 262
Define the database schema and update functions for the hosting_server module.

Code

function hosting_server_update_6201() {
  if (!db_table_exists('hosting_ssl_site')) {
    return array(
      array(
        'success' => TRUE,
      ),
    );
  }
  $ret = array();
  $schema = 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',
      ),
    ),
  );
  db_create_table($ret, 'hosting_ssl_cert_ips', $schema);
  return $ret;
}