summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-02-18 16:49:23 +0000
committerDries Buytaert <dries@buytaert.net>2008-02-18 16:49:23 +0000
commit029b6b914fdef60b060e3e7db5cbaa6f303ad78e (patch)
tree5dd45eaad870d801fdad20995940d1819666ca42
parent43aa968f90b42fc7b97642c7aad06d26070e2981 (diff)
downloadbrdo-029b6b914fdef60b060e3e7db5cbaa6f303ad78e.tar.gz
brdo-029b6b914fdef60b060e3e7db5cbaa6f303ad78e.tar.bz2
- Patch #196862 by earnie et al: make drupal_lookup_path() a tad faster by eliminating an SQL query.
-rw-r--r--includes/path.inc9
1 files changed, 2 insertions, 7 deletions
diff --git a/includes/path.inc b/includes/path.inc
index df168c5a4..380ff31f8 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -46,20 +46,15 @@ function drupal_init_path() {
function drupal_lookup_path($action, $path = '', $path_language = '') {
global $language;
// $map is an array with language keys, holding arrays of Drupal paths to alias relations
- static $map = array(), $no_src = array(), $count;
+ static $map = array(), $no_src = array();
$path_language = $path_language ? $path_language : $language->language;
- // 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}'));
- }
-
if ($action == 'wipe') {
$map = array();
$no_src = array();
}
- elseif ($count > 0 && $path != '') {
+ elseif (module_exists('path') && $path != '') {
if ($action == 'alias') {
if (isset($map[$path_language][$path])) {
return $map[$path_language][$path];