You are here

content_access.install in Content Access 7

Content access install file.

File

content_access.install
View source
<?php

/**
 * @file
 * Content access install file.
 */

/**
 * Implements hook_uninstall().
 */
function content_access_uninstall() {
  foreach (node_type_get_types() as $type_name => $type) {
    variable_del('content_access_' . $type_name);
  }
}

/**
 * Implements hook_schema().
 */
function content_access_schema() {
  $schema['content_access'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'settings' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'medium',
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}

/**
 * Convert content type settings to a new features-friendly storage format.
 */
function content_access_update_7101() {
  $settings = variable_get('content_access_settings', array());
  $settings_new = array();
  foreach ($settings as $setting => $data) {
    foreach ($data as $type_name => $value) {
      $settings_new[$type_name][$setting] = $value;
    }
  }
  foreach ($settings_new as $type_name => $data) {
    variable_set('content_access_' . $type_name, $data);
  }
  variable_del('content_access_settings');
}

/**
 * Enable notice to rebuild node access permissions since a new node access realm
 * was added to respect the core "view own unpublished content" permission
 */
function content_access_update_7102() {
  node_access_needs_rebuild(TRUE);
}

Functions

Namesort descending Description
content_access_schema Implements hook_schema().
content_access_uninstall Implements hook_uninstall().
content_access_update_7101 Convert content type settings to a new features-friendly storage format.
content_access_update_7102 Enable notice to rebuild node access permissions since a new node access realm was added to respect the core "view own unpublished content" permission