-
Notifications
You must be signed in to change notification settings - Fork 0
/
excerpt.install
41 lines (37 loc) · 970 Bytes
/
excerpt.install
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
<?php
/* $Id: excerpt.install,v 1.5 2009/03/31 01:32:53 weitzman Exp $ */
/**
* Implementation of hook_uninstall().
*/
function excerpt_uninstall() {
// Delete all the excerpt variables and clear the variable cache.
db_query("DELETE FROM {variable} WHERE name LIKE 'excerpt_%'");
}
/**
* @defgroup updates-4.7-to-5.0 Excerpt updates from 4.7 to 5.0
* @{
*/
/**
* Update variable names.
*/
function excerpt_update_5000() {
$ret = array();
foreach (node_get_types() as $type) {
$old_var = 'excerpt_option_'. $type->type;
$old_val = variable_get($old_var, NULL);
if (isset($old_val)) {
$new_var = 'excerpt_'. $type->type;
$new_val = variable_get($new_var, NULL);
// Don't overwrite existing variables.
if (!isset($new_val)) {
variable_set($new_var, $old_val);
}
// Delete old_val variable.
variable_del($old_var);
}
}
return $ret;
}
/**
* @} End of "defgroup updates-4.7-to-5.0"
*/