You are here

function maxlength_update_1 in Maxlength 6.2

Same name and namespace in other branches
  1. 5.2 maxlength.install \maxlength_update_1()
  2. 5 maxlength.install \maxlength_update_1()
  3. 6 maxlength.install \maxlength_update_1()

Implementation of hook_update_N().

File

./maxlength.install, line 10
Install file for the maxlenght module

Code

function maxlength_update_1() {
  foreach (node_get_types() as $type => $name) {
    $code_old = 'maxlength_node_type_' . $type;
    $code_new = 'maxlength_' . $type;
    $max_title = variable_get($code_old . '_maxlength_title', '');
    $max_body = variable_get($code_old . '_maxlength_body', '');
    variable_set($code_new . '_t', $max_title);
    variable_set($code_new . '_b', $max_body);
    variable_del($code_old . '_maxlength_title');
    variable_del($code_old . '_maxlength_body');

    // old variables, not used anymore
    variable_del($code_old . '_limit');
    variable_del($code_old . '_maxlength');
  }
  return array();
}