- Patch #100957 by chx: clean up drupal_lookup_path()
parent
0d57baef27
commit
5c3086ee4a
|
@ -42,10 +42,10 @@ function drupal_init_path() {
|
|||
function drupal_lookup_path($action, $path = '') {
|
||||
// $map keys are Drupal paths and the values are the corresponding aliases
|
||||
static $map = array(), $no_src = array();
|
||||
static $count = NULL;
|
||||
static $count;
|
||||
|
||||
// Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
|
||||
if ($count === NULL) {
|
||||
if (!isset($count)) {
|
||||
$count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,7 @@ function drupal_lookup_path($action, $path = '') {
|
|||
if (isset($map[$path])) {
|
||||
return $map[$path];
|
||||
}
|
||||
if (!$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path))) {
|
||||
$alias = FALSE;
|
||||
}
|
||||
$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path));
|
||||
$map[$path] = $alias;
|
||||
return $alias;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue