You are here

function nodewords_update_6160 in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 6.2 nodewords.install \nodewords_update_6160()

Implements hook_update_N().

File

./nodewords.install, line 1203
Installation file for nodewords.module.

Code

function nodewords_update_6160(&$sandbox) {
  $ret = array();
  drupal_load('module', 'nodewords');
  if (!isset($sandbox['progress'])) {
    $sandbox['progress'] = 0;
  }
  $old_types = array(
    'default',
    'errorpage',
    'frontpage',
    'node',
    'page',
    'pager',
    'term',
    'tracker',
    'user',
    'vocabulary',
  );
  $new_types = array(
    NODEWORDS_TYPE_DEFAULT,
    NODEWORDS_TYPE_ERRORPAGE,
    NODEWORDS_TYPE_FRONTPAGE,
    NODEWORDS_TYPE_NODE,
    NODEWORDS_TYPE_PAGE,
    NODEWORDS_TYPE_PAGER,
    NODEWORDS_TYPE_TERM,
    NODEWORDS_TYPE_TRACKER,
    NODEWORDS_TYPE_USER,
    NODEWORDS_TYPE_VOCABULARY,
  );
  $ret[] = update_sql("UPDATE {nodewords} SET type = '" . $new_types[$sandbox['progress']] . "' WHERE type = '" . $old_types[$sandbox['progress']++] . "'");
  $ret['#finished'] = $sandbox['progress'] / 10;
  return $ret;
}