The decision of a problem have offered at a forum
http://www.drupal.ru/node/2317#comment-9921
please review:
=============
file path.inc:

diff -u path.inc path-NEW.inc

--- path.inc    2006-07-18 14:40:02.000000000 +0300
+++ path-NEW.inc        2006-10-11 00:14:06.000000000 +0300
@@ -1,5 +1,5 @@
 <?php
-// $Id: path.inc,v 1.4.2.1 2006/07/18 11:40:02 killes Exp $
+// $Id: path.inc,v 1.4 2006/04/24 19:25:37 dries Exp $

 /**
  * @file
@@ -13,7 +13,19 @@
 /**
  * Initialize the $_GET['q'] variable to the proper normal path.
  */
+
 function drupal_init_path() {
+global $map_alias;
+  $c=count($map_alias);
+if (empty($c))
+{
+$sql = "Select src,dst FROM {url_alias} ";
+$res=db_query($sql);
+    while( $row=db_fetch_array($res))
+    {
+    $map_alias[$row['src']]=$row['dst'];
+  }
+  }
   if (!empty($_GET['q'])) {
     $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/'));
   }
@@ -39,42 +51,23 @@
  *   found.
  */
 function drupal_lookup_path($action, $path = '') {
+global $map_alias;
   static $map = array();
-  static $count = NULL;
-
-  if ($count === NULL) {
-    $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
-  }
-
   if ($action == 'wipe') {
     $map = array();
   }
-  elseif ($count > 0 && $path != '') {
+  elseif ($path != '') {
     if ($action == 'alias') {
-      if (isset($map[$path])) {
-        return $map[$path];
-      }
-      if ($alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path))) {
-        $map[$path] = $alias;
-        return $alias;
-      }
-      else {
-        $map[$path] = $path;
-      }
+      if (!isset($map_alias[$path])) $map_alias[$path]=$path;
+      return  $map_alias[$path];
     }
     elseif ($action == 'source') {
-      if ($alias = array_search($path, $map)) {
+      if (is_array($map_alias) and $alias = array_search($path, $map_alias)) {
         return $alias;
       }
-      if (!isset($map[$path])) {
-        if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $path))) {
-          $map[$src] = $path;
-          return $src;
-        }
-      }
+      else  return False;
     }
   }
-
   return FALSE;
 }

============================
The result file path.inc in attachment:

CommentFileSizeAuthor
path.inc5.08 KBkiev1.org

Comments

FiReaNGeL’s picture

Could you give more details about what this is trying to fix, and how? I fear not many people around here speaks russian :)

dries’s picture

This solution only works for sites with a couple of aliases. For sites that have thousands of path aliases, this won't scale.

Zen’s picture

Status: Needs review » Needs work

changing status as per Dries' comments.

gerhard killesreiter’s picture

Status: Needs work » Closed (works as designed)

This was a design decision made in the early stages of the 4.7 development cycle. Not neccessarily the best one for a lot of sites, but nevertheless a design decision.