Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.184 diff -u -F^f -r1.184 database.mysql --- database/database.mysql 7 May 2005 11:39:54 -0000 1.184 +++ database/database.mysql 8 May 2005 00:40:39 -0000 @@ -484,7 +484,8 @@ src varchar(128) NOT NULL default '', dst varchar(128) NOT NULL default '', PRIMARY KEY (pid), - UNIQUE KEY dst (dst) + UNIQUE KEY dst (dst), + KEY src (src) ) TYPE=MyISAM; -- Index: database/database.pgsql =================================================================== RCS file: /cvs/drupal/drupal/database/database.pgsql,v retrieving revision 1.121 diff -u -F^f -r1.121 database.pgsql --- database/database.pgsql 7 May 2005 11:39:54 -0000 1.121 +++ database/database.pgsql 8 May 2005 00:40:43 -0000 @@ -499,6 +499,7 @@ PRIMARY KEY (pid) ); CREATE INDEX url_alias_dst_idx ON url_alias(dst); +CREATE INDEX url_alias_src_idx ON url_alias(src); -- -- Table structure for permission -- Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.46 diff -u -F^f -r1.46 bootstrap.inc --- includes/bootstrap.inc 12 Apr 2005 16:55:11 -0000 1.46 +++ includes/bootstrap.inc 8 May 2005 00:40:49 -0000 @@ -403,32 +403,12 @@ function drupal_load($type, $name) { } /** - * Return an array mapping path aliases to their internal Drupal paths. - */ -function drupal_get_path_map($action = '') { - static $map = NULL; - - if ($action == 'rebuild') { - $map = NULL; - } - - if (is_null($map)) { - $map = array(); // Make $map non-null in case no aliases are defined. - $result = db_query('SELECT * FROM {url_alias}'); - while ($data = db_fetch_object($result)) { - $map[$data->dst] = $data->src; - } - } - - return $map; -} - -/** * Given an internal Drupal path, return the alias set by the administrator. */ function drupal_get_path_alias($path) { - if (($map = drupal_get_path_map()) && ($newpath = array_search($path, $map))) { - return $newpath; + $result = db_query("SELECT dst FROM {url_alias} WHERE src='%s'", $path); + if ($data = db_fetch_object($result)) { + return $data->dst; } elseif (function_exists('conf_url_rewrite')) { return conf_url_rewrite($path, 'outgoing'); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.440 diff -u -F^f -r1.440 common.inc --- includes/common.inc 7 May 2005 01:48:06 -0000 1.440 +++ includes/common.inc 8 May 2005 00:41:07 -0000 @@ -80,18 +80,12 @@ function drupal_get_html_head() { } /** - * Regenerate the path map from the information in the database. - */ -function drupal_rebuild_path_map() { - drupal_get_path_map('rebuild'); -} - -/** * Given a path alias, return the internal path it represents. */ function drupal_get_normal_path($path) { - if (($map = drupal_get_path_map()) && isset($map[$path])) { - return $map[$path]; + $result = db_query("SELECT src FROM {url_alias} WHERE dst='%s'", $path); + if ($data = db_fetch_object($result)) { + return $data->src; } elseif (function_exists('conf_url_rewrite')) { return conf_url_rewrite($path, 'incoming'); Index: modules/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path.module,v retrieving revision 1.57 diff -u -F^f -r1.57 path.module --- modules/path.module 24 Apr 2005 16:34:34 -0000 1.57 +++ modules/path.module 8 May 2005 00:41:12 -0000 @@ -132,11 +132,9 @@ function path_admin_delete($pid = 0) { function path_set_alias($path = NULL, $alias = NULL, $pid = NULL) { if ($path && !$alias) { db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path); - drupal_rebuild_path_map(); } else if (!$path && $alias) { db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias); - drupal_rebuild_path_map(); } else if ($path && $alias) { $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s'", $path)); @@ -145,7 +143,6 @@ function path_set_alias($path = NULL, $a // We have an insert: if ($path_count == 0 && $alias_count == 0) { db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias); - drupal_rebuild_path_map(); } else if ($path_count >= 1 && $alias_count == 0) { if ($pid) { @@ -154,11 +151,9 @@ function path_set_alias($path = NULL, $a else { db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $path, $alias); } - drupal_rebuild_path_map(); } else if ($path_count == 0 && $alias_count == 1) { db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s'", $path, $alias); - drupal_rebuild_path_map(); } else if ($path_count == 1 && $alias_count == 1) { // This will delete the path that alias was originally pointing to: