-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflat_book.install
More file actions
84 lines (80 loc) · 2.23 KB
/
flat_book.install
File metadata and controls
84 lines (80 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
// $Id$
/**
* @file
* install file for flat_book.
* creates default persistant variables.
*/
/**
* Implementation of hook_uninstall().
* Delete settings variables, empty cache, and remove custom table.
*/
function flat_book_uninstall() {
drupal_uninstall_schema('flat_book');
db_query("DELETE FROM {variable} WHERE name LIKE 'flat_book%%'");
cache_clear_all();
}
/**
* Implementation of hook_install().
*/
function flat_book_install() {
drupal_install_schema('flat_book');
}
/**
* Implementation of hook_schema()
*/
function flat_book_schema() {
$schema['flat_book_flattened_nodes'] = array(
'description' => 'Stores which nodes have been flattened per book',
'fields' => array(
'bid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The {book}.bid of the book which contains the nodes being flattened.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {node}.nid of the book page being flattened.',
),
),
'primary key' => array('nid'),
);
return $schema;
}
/**
* Update to 6.x-1.2
* {flat_book_flattened_nodes} table added.
* @see http://drupal.org/node/150220 for why I have duplicated
* the schema.
*/
function flat_book_update_6102() {
$schema['flat_book_flattened_nodes'] = array(
'description' => 'Stores which nodes have been flattened per book',
'fields' => array(
'bid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The {book}.bid of the book which contains the nodes being flattened.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {node}.nid of the book page being flattened.',
),
),
'primary key' => array('nid'),
);
$ret = array();
db_create_table($ret, 'flat_book_flattened_nodes', $schema['flat_book_flattened_nodes']);
$max = variable_get('flat_book_max_menu_depth', 3);
variable_set('flat_book_sitewide_max_depth', $max);
variable_del('flat_book_max_menu_depth');
return $ret;
}