You are here

function system_update_120 in Drupal 4

Same name and namespace in other branches
  1. 5 modules/system/system.install \system_update_120()

File

database/updates.inc, line 287

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";
      update_sql("UPDATE {url_alias} SET src = '%s' WHERE pid = '%s'", $new, $alias->pid);
    }
  }
  return $ret;
}