You are here

function system_update_120 in Drupal 5

Same name and namespace in other branches
  1. 4 database/updates.inc \system_update_120()

File

modules/system/system.install, line 1397

Code

function system_update_120() {
  $ret = array();

  // Rewrite old URL aliases. Works for both PostgreSQL and MySQL
  $result = db_query("SELECT pid, src FROM {url_alias} WHERE src LIKE 'blog/%%'");
  while ($alias = db_fetch_object($result)) {
    list(, $page, $op, $uid) = explode('/', $alias->src);
    if ($page == 'feed') {
      $new = "blog/{$uid}/feed";
      db_query("UPDATE {url_alias} SET src = '%s' WHERE pid = %d", $new, $alias->pid);
    }
  }
  return $ret;
}