Project

General

Profile

Paste
Download (1.2 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / content_access / content_access.install @ ae34fb26

1
<?php
2

    
3
/**
4
 * @file
5
 * Content access install file.
6
 */
7

    
8
/**
9
 * Implements hook_uninstall().
10
 */
11
function content_access_uninstall() {
12
  foreach (node_type_get_types() as $type_name => $type) {
13
    variable_del('content_access_' . $type_name);
14
  }
15
}
16

    
17
/**
18
 * Implements hook_schema().
19
 */
20
function content_access_schema() {
21
  $schema['content_access'] = array(
22
    'fields' => array(
23
      'nid' => array(
24
        'type' => 'int',
25
        'unsigned' => TRUE,
26
        'not null' => TRUE,
27
        'default' => 0
28
      ),
29
      'settings' => array(
30
        'type' => 'text',
31
        'not null' => FALSE,
32
        'size' => 'medium'
33
      ),
34
    ),
35
    'primary key' => array('nid')
36
  );
37
  return $schema;
38
}
39

    
40
/**
41
 * Convert content type settings to a new features-friendly storage format.
42
 */
43
function content_access_update_7101() {
44
  $settings = variable_get('content_access_settings', array());
45
  $settings_new = array();
46
  foreach ($settings as $setting => $data) {
47
    foreach ($data as $type_name => $value) {
48
      $settings_new[$type_name][$setting] = $value;
49
    }
50
  }
51
  foreach ($settings_new as $type_name => $data) {
52
    variable_set('content_access_' . $type_name, $data);
53
  }
54
  variable_del('content_access_settings');
55
}