You are here

module_grants.install in Module Grants 7

Same filename and directory in other branches
  1. 6.4 module_grants.install
  2. 6.3 module_grants.install

Install and uninstall hooks for Module Grants module

File

module_grants.install
View source
<?php

/**
 * @file
 * Install and uninstall hooks for Module Grants module
 */

/**
 * Implementation of hook_install().
 */
function module_grants_install() {
}

/**
 * Implementation of hook_uninstall().
 */
function module_grants_uninstall() {
  variable_del('module_grants_lenient');
  variable_del('module_grants_OR_modules');
}

/**
 * Implements hook_enable()
 */
function module_grants_enable() {
  db_update('system')
    ->fields(array(
    'weight' => 10000,
  ))
    ->condition('type', 'module')
    ->condition('name', 'module_grants')
    ->execute();
}

/**
 * Implements hook_requirements().
 */
function module_grants_requirements($phase) {
  $ret = array();
  if ($phase == 'runtime') {
    $ret['module_grants_hook_module_implements_alter']['title'] = t('module_implements_alter hook order check');
    $modules = module_implements('module_implements_alter');
    $last_module = end($modules);
    $ret['module_grants_hook_module_implements_alter']['value'] = $last_module;
    if ($last_module === 'module_grants') {
      $ret['module_grants_hook_module_implements_alter']['description'] = t("Module grants' hook_module_implements_alter is the last hook to be called.");
      $ret['module_grants_hook_module_implements_alter']['severity'] = REQUIREMENT_OK;
    }
    else {
      $ret['module_grants_hook_module_implements_alter']['description'] = t("Module grants' hook_module_implements_alter is not last hook to be called,\n        every changes to hook_node_access in the hook_module_implements_alter after it will be ignored. The last hook_module_implements_alter is from module @module", array(
        '@module',
        $last_module,
      ));
      $ret['module_grants_hook_module_implements_alter']['severity'] = REQUIREMENT_WARNING;
    }
  }
  return $ret;
}

Functions