| 1 |
<?php
|
| 2 |
// $Id: maxlength.install,v 1.6 2008/09/27 18:39:51 mariuss Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Install file for the maxlenght module
|
| 6 |
*/
|
| 7 |
|
| 8 |
require_once 'maxlength.inc';
|
| 9 |
|
| 10 |
// hook_update_N
|
| 11 |
function maxlength_update_1() {
|
| 12 |
foreach (node_get_types() as $type => $name) {
|
| 13 |
$code_old = 'maxlength_node_type_'. $type;
|
| 14 |
$code_new = MAXLENGTH_NODE_TYPE . $type;
|
| 15 |
|
| 16 |
$max_title = variable_get($code_old .'_maxlength_title', '');
|
| 17 |
$max_body = variable_get($code_old .'_maxlength_body', '');
|
| 18 |
|
| 19 |
variable_set($code_new .'_t', $max_title);
|
| 20 |
variable_set($code_new .'_b', $max_body);
|
| 21 |
|
| 22 |
variable_del($code_old .'_maxlength_title');
|
| 23 |
variable_del($code_old .'_maxlength_body');
|
| 24 |
|
| 25 |
// old variables, not used anymore
|
| 26 |
variable_del($code_old .'_limit');
|
| 27 |
variable_del($code_old .'_maxlength');
|
| 28 |
}
|
| 29 |
|
| 30 |
return array();
|
| 31 |
}
|
| 32 |
|
| 33 |
// hook_unistall
|
| 34 |
function maxlength_uninstall() {
|
| 35 |
foreach (node_get_types() as $type => $name) {
|
| 36 |
$code = MAXLENGTH_NODE_TYPE . $type;
|
| 37 |
|
| 38 |
variable_del($code .'_t');
|
| 39 |
variable_del($code .'_b');
|
| 40 |
}
|
| 41 |
}
|