You are here

function protected_node_update_1 in Protected Node 5

Implementation of hook_update_N()

File

./protected_node.install, line 49

Code

function protected_node_update_1() {
  global $protected_node_salt;
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    case 'pgsql':
      $result = db_query("SELECT nid, passwd FROM {protected_nodes}");
      while (($node = db_fetch_object($result)) != null) {
        $log = update_sql("UPDATE {protected_nodes} SET passwd = '" . sha1($protected_node_salt . $node->passwd) . "' WHERE nid = " . $node->nid);
        $log['query'] = '****QUERY CONTAINS PASSWORD HASHES - REMOVED CONTENT****';
        $ret[] = $log;
      }
      break;
  }
  return $ret;
}