You are here

function drupal_path_alias_whitelist_rebuild in Redis 7.2

Same name and namespace in other branches
  1. 7.3 redis.path.inc \drupal_path_alias_whitelist_rebuild()

Rebuild the path alias white list.

Parameters

$source: An optional system path for which an alias is being inserted.

Return value

An array containing a white list of path aliases.

2 calls to drupal_path_alias_whitelist_rebuild()
drupal_clear_path_cache in ./redis.path.inc
Clear the path cache.
drupal_lookup_path in ./redis.path.inc
Given an alias, return its Drupal system URL if one exists. Given a Drupal system URL return one of its aliases if such a one exists. Otherwise, return FALSE.

File

./redis.path.inc, line 363
Drupal default includes/path.inc file copy which only differs in:

Code

function drupal_path_alias_whitelist_rebuild($source = NULL) {

  // When paths are inserted, only rebuild the whitelist if the system path
  // has a top level component which is not already in the whitelist.
  if (!empty($source)) {
    $whitelist = variable_get('path_alias_whitelist', NULL);
    if (isset($whitelist[strtok($source, '/')])) {
      return $whitelist;
    }
  }

  // For each alias in the database, get the top level component of the system
  // path it corresponds to. This is the portion of the path before the first
  // '/', if present, otherwise the whole path itself.
  $whitelist = array();
  $result = db_query("SELECT DISTINCT SUBSTRING_INDEX(source, '/', 1) AS path FROM {url_alias}");
  foreach ($result as $row) {
    $whitelist[$row->path] = TRUE;
  }
  variable_set('path_alias_whitelist', $whitelist);
  return $whitelist;
}