function 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.

3 calls to drupal_path_alias_whitelist_rebuild()
drupal_clear_path_cache in drupal/includes/path.inc
Clear the path cache.
drupal_lookup_path in drupal/includes/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.
system_update_7042 in drupal/modules/system/system.install
Upgrade the {url_alias} table and create a cache bin for path aliases.

File

drupal/includes/path.inc, line 368
Functions to handle paths in Drupal, including path aliasing.

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;
}