Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.36 diff -u -p -r1.36 path.inc --- includes/path.inc 16 May 2009 19:07:02 -0000 1.36 +++ includes/path.inc 16 May 2009 21:33:29 -0000 @@ -50,6 +50,7 @@ function drupal_lookup_path($action, $pa $no_src = &drupal_static(__FUNCTION__ . ':no_src', array()); $count = &drupal_static(__FUNCTION__ . ':count'); $system_paths = &drupal_static(__FUNCTION__ . ':system_paths'); + $blacklist = &drupal_static(__FUNCTION__ . ':blacklist'); $no_aliases = &drupal_static(__FUNCTION__ . ':no_alias', array()); $first_call = &drupal_static(__FUNCTION__ . ':first_call', TRUE); @@ -70,9 +71,26 @@ function drupal_lookup_path($action, $pa elseif ($count > 0 && $path != '') { if ($action == 'alias') { // During the first call to drupal_lookup_path() per language, load the - // expected system paths for the page from cache. + // expected system paths for the page from cache and fetch the path + // blacklist variable. if ($first_call) { $first_call = FALSE; + $blacklist = variable_get('path_optimization_list', 'admin* +*/add +*/edit +*/outline +*/revisions +*/track +book +comment/* +filter* +logout +poll +profile +tracker* +user +user/register +user/login'); $map[$path_language] = array(); // Load system paths from cache. $cid = current_path(); @@ -93,9 +111,13 @@ function drupal_lookup_path($action, $pa if (isset($map[$path_language][$path])) { return $map[$path_language][$path]; } + // If the alias is in the blacklist, return FALSE. + if (drupal_match_path($path, $blacklist)) { + return FALSE; + } // For system paths which were not cached, query aliases individually. - else if (!isset($no_aliases[$path_language][$path])) { - // Get the most fitting result falling back with alias without language + if (!isset($no_aliases[$path_language][$path])) { + // Get the most fitting result falling back with alias without language. $alias = db_query("SELECT dst FROM {url_alias} WHERE src = :src AND language IN(:language, '') ORDER BY language DESC", array( ':src' => $path, ':language' => $path_language Index: modules/path/path.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v retrieving revision 1.21 diff -u -p -r1.21 path.admin.inc --- modules/path/path.admin.inc 16 May 2009 15:23:16 -0000 1.21 +++ modules/path/path.admin.inc 16 May 2009 21:33:30 -0000 @@ -140,6 +140,28 @@ function path_admin_form_validate($form, $src = $form_state['values']['src']; $dst = $form_state['values']['dst']; $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0; + $blacklist = variable_get('path_optimization_list', 'admin* +*/add +*/edit +*/outline +*/revisions +*/track +book +comment/* +filter* +logout +poll +profile +tracker* +user +user/register +user/login'); + + if (drupal_match_path($src, $blacklist)) { + // @TODO Offer a pointer on how to correct this. + form_set_error('src', t("The path '@link_path' cannot be aliased because it is skipped by default when querying path aliases.", array('@link_path' => $src))); + } + // Language is only set if locale module is enabled, otherwise save for all languages. $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';