diff options
-rw-r--r-- | includes/common.inc | 12 |
1 files changed, 10 insertions, 2 deletions
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; |