You are here

securesite.install in Secure Site 8

Secure Site installation functions.

File

securesite.install
View source
<?php

/**
 * @file
 * Secure Site installation functions.
 */

/**
 * Implements hook_install().
 */
function securesite_install() {
  $config_securesite = \Drupal::config('securesite.settings');
  $config_site = \Drupal::config('system.site');
  $config_securesite
    ->set('securesite_digest_script', drupal_get_path('module', 'securesite') . '/digest_md5/digest_md5.php');
  $config_securesite
    ->set('securesite_password_script', drupal_get_path('module', 'securesite') . '/digest_md5/stored_passwords.php');
  $config_securesite
    ->set('securesite_realm', $config_site
    ->get('name'));
  $config_securesite
    ->set('securesite_403', $config_site
    ->get('page.403'));
  $config_securesite
    ->save();
}

/**
 * Implements hook_uninstall().
 */
function securesite_uninstall() {
  $config_securesite = \Drupal::config('securesite.settings');
  \Drupal::config('system.site')
    ->set('page.403', $config_securesite
    ->get('securesite_403'))
    ->save();
  if (in_array(SECURESITE_DIGEST, $config_securesite
    ->get('securesite_type'))) {
    $script = $config_securesite
      ->get('securesite_password_script');
    $realm = $config_securesite
      ->get('securesite_realm');
    exec("{$script} realm=" . escapeshellarg($realm) . ' op=delete');
  }
}

Functions

Namesort descending Description
securesite_install Implements hook_install().
securesite_uninstall Implements hook_uninstall().