1 |
85ad3d82
|
Assos Assos
|
<?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 |
|
|
foreach ($settings as $setting => $data) {
|
46 |
|
|
foreach ($data as $type_name => $value) {
|
47 |
|
|
$settings_new[$type_name][$setting] = $value;
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
foreach ($settings_new as $type_name => $data) {
|
51 |
|
|
variable_set('content_access_' . $type_name, $data);
|
52 |
|
|
}
|
53 |
|
|
variable_del('content_access_settings');
|
54 |
|
|
} |