protected static function ExpireAPI::processInternalPaths in Cache Expiration 7.2
Looks for aliases and wildcards in internal paths. If finds some - add to an array with expiration paths.
Parameters
$internal_paths: Array of internal paths.
null $langcode: Language code of object that is expiring.
Return value
array
1 call to ExpireAPI::processInternalPaths()
- ExpireAPI::executeExpiration in includes/
expire.api.inc - Executes internal or external cache expiration.
File
- includes/
expire.api.inc, line 400 - Provides internal API for page cache flushes.
Class
- ExpireAPI
- @file Provides internal API for page cache flushes.
Code
protected static function processInternalPaths($internal_paths, $langcode = NULL) {
$urls = array();
$wildcards = array();
foreach ($internal_paths as $path) {
$wildcard = FALSE;
// Every URL may contain |wildcard suffix, so we should check this.
$path_parts = explode('|', $path);
if (sizeof($path_parts) > 1 && $path_parts[sizeof($path_parts) - 1] == 'wildcard') {
$wildcard = TRUE;
array_pop($path_parts);
// Remove 'wildcard' from path.
$path = implode('|', $path_parts);
}
// Parse internal path.
$parsed_path = parse_url($path);
if (!empty($parsed_path['query'])) {
// Parse the query string into array.
parse_str($parsed_path['query'], $parsed_path['query']);
}
// Collect array with information about expired URLs and its wildcards.
$urls[$path] = array(
'path' => $parsed_path['path'],
'query' => !empty($parsed_path['query']) ? $parsed_path['query'] : array(),
);
$wildcards[$path] = $wildcard;
// Don't process empty pass, because otherwise drupal will return us
// alias for the current page. And that is not what we actually want.
if ($path == NULL) {
continue;
}
// Get the path alias for this path, and add it to the array if one was
// found.
$alias = drupal_get_path_alias($path, $langcode);
if ($alias != $path) {
$urls[$alias] = array(
'path' => $alias,
'query' => array(),
);
$wildcards[$alias] = $wildcard;
}
}
return array(
$urls,
$wildcards,
);
}