You are here

function forward_update_3 in Forward 5

Same name and namespace in other branches
  1. 6 forward.install \forward_update_3()
  2. 7 forward.install \forward_update_3()

Changed forward_statistics to handle non-node paths

File

./forward.install, line 97

Code

function forward_update_3() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {forward_log} ADD COLUMN path varchar(255) NOT NULL default '<front>' FIRST");
      break;
    case 'pgsql':
      db_add_column($ret, 'forward_log', 'path', 'varchar', array(
        'size' => 255,
        'default' => "'<front>'",
        'not null' => TRUE,
      ));
      break;
  }
  $ret[] = update_sql("UPDATE {forward_log} SET path = CONCAT('node/', nid) WHERE nid != 0");
  $ret[] = update_sql("UPDATE {forward_log} SET path = '<front>' WHERE nid = 0");
  $ret[] = update_sql("ALTER TABLE {forward_log} DROP COLUMN nid");
  return $ret;
}