diff -urx '*js' drupal-5.12/includes/cache.inc drupal-5/includes/cache.inc --- drupal-5.12/includes/cache.inc 2008-02-09 18:05:00.000000000 -0800 +++ drupal-5/includes/cache.inc 2008-10-06 16:49:59.000000000 -0700 @@ -12,7 +12,8 @@ */ function cache_get($key, $table = 'cache') { global $user; - + static $db_cache; + // Garbage collection necessary when enforcing a minimum cache lifetime $cache_flush = variable_get('cache_flush', 0); if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { @@ -21,6 +22,25 @@ // Time to flush old cache data db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); } + + if(eregi("views", $table)) { + if( ! isset($db_cache) ) { + $result= db_query("SELECT * FROM {". $table ."}"); + while($row = db_fetch_object($result)) { + $db_cache[$table][$row->cid]=$row; + } + } + $cache = $db_cache[$table][$key]; + if ($user->cache > $cache->created) { + // This cache data is too old and thus not valid for us, ignore it. + return 0; + } + else { + $cache->data = db_decode_blob($cache->data); + } + + return $cache; + } $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {". $table ."} WHERE cid = '%s'", $key)); if (isset($cache->data)) { diff -urx '*js' drupal-5.12/includes/path.inc drupal-5/includes/path.inc --- drupal-5.12/includes/path.inc 2006-12-23 14:04:52.000000000 -0800 +++ drupal-5/includes/path.inc 2008-10-06 16:17:29.000000000 -0700 @@ -44,6 +44,23 @@ static $map = array(), $no_src = array(); static $count; + if(eregi("\.(jpg|png|bmp|jpeg|gif)$", $path)) { + return $path; + } + + if(eregi("^(comment|admin|logout|fivestar)", $path)) { + return $path; + } + + + if(sizeof($map)==0) { + $result = db_query("SELECT src,dst FROM {url_alias}"); + while($row = db_fetch_array($result)) { + $key = $row['src']; + $map[$key] = $row['dst']; + } + } + // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases if (!isset($count)) { $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}')); @@ -57,6 +74,8 @@ if ($action == 'alias') { if (isset($map[$path])) { return $map[$path]; + } else { + return $path; } $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path)); $map[$path] = $alias;