-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdated.install
More file actions
47 lines (44 loc) · 1.14 KB
/
updated.install
File metadata and controls
47 lines (44 loc) · 1.14 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
<?php
/**
* @file
* Install, Uninstall, Update, and Requirements functions for update module.
*/
/**
* Implements hook_install().
*/
function updated_install() {
// Add a show_updated column to the node table.
db_add_field('node', 'show_updated', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
// Add a show_updated column to the node_revision table.
db_add_field('node_revision', 'show_updated', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
}
/**
* Implements hook_uninstall().
*/
function updated_uninstall() {
// Remove show_updated column from node table.
db_drop_field('node', 'show_updated');
// Remove show_updated column from node_revision table.
db_drop_field('node_revision', 'show_updated');
}
/**
* Convert variables to config.
*/
function updated_update_1000() {
$config = config("updated.settings");
foreach (node_type_get_types() as $type) {
$variable_name = 'node_updated_' . $type->name;
if ($value = update_variable_get($variable_name, NULL)) {
$config->set($type->name, $value)->save();
}
update_variable_del($variable_name);
}
}