You are here

paranoia.install in Paranoia 7

Same filename and directory in other branches
  1. 8 paranoia.install
  2. 6 paranoia.install

Disable php module & set install message for Paranoia.

File

paranoia.install
View source
<?php

/**
 * @file
 * Disable php module & set install message for Paranoia.
 *
 * @ingroup paranoia
 */

/**
 * Implements hook_enable().
 */
function paranoia_enable() {

  // Some day it should be possible to remove this require_once. Some day.
  require_once dirname(__FILE__) . '/paranoia.module';

  // Disable the risky modules.
  paranoia_remove_disabled_modules();

  // Manually remove any enabled risky permissions.
  _paranoia_remove_risky_permissions();
  $t = get_t();
  drupal_set_message($t('Risky permissions have been automatically disabled.'));
}

/**
 * Implements hook_requirements().
 */
function paranoia_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // Ensure the PHP module is not enabled.
    if (module_exists('php')) {
      $t = get_t();
      $requirements['paranoia_php'] = array(
        'title' => $t('Paranoia'),
        'description' => $t('The PHP module is enabled. This module should be disabled (but paranoia module prevents it from showing in the module admin form).  It may have been enabled in the database, circumventing the effectiveness of paranoia module.'),
        'severity' => REQUIREMENT_ERROR,
        'value' => '',
      );
    }
  }
  return $requirements;
}

/**
 * Implements hook_modules_enabled().
 */
function paranoia_modules_enabled($modules) {
  _paranoia_remove_risky_permissions();
}