From d2175fdcbd1b9703c83050f626e802bef02b5116 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 9 Oct 2003 17:22:22 +0000 Subject: - Fixed cache issue with path map. --- includes/common.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index a04115a55..b58bb749f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -29,17 +29,25 @@ function conf_init() { * Build the alias/path array */ function drupal_get_path_map($action = "") { + + static $cache; static $map; if ($action == "rebuild") { $map = NULL; + $cache = 0; } - if (empty($map)) { - $result = db_query("SELECT * FROM {path}"); + if (!$cache) { + if (!$result) { + $result = db_query("SELECT * FROM {path}"); + } + while ($data = db_fetch_object($result)) { $map[$data->dst] = $data->src; } + + $cache = 1; } return $map; -- cgit v1.2.3