Commit 76edb0a2 authored by Spleshka's avatar Spleshka

Changed sequence when hook_expire_cache_alter() is invoked. It should be...

Changed sequence when hook_expire_cache_alter() is invoked. It should be executed after all expire preprocesses are done, but not before.
parent 1c569df8
......@@ -9,12 +9,30 @@
* Provides possibility to flush pages for external cache storages.
*
* @param $urls
* List of absolute URLs that should be flushed.
* List of internal paths and/or absolute URLs that should be flushed.
*
* Example of array (when base url include option is enabled):
* array(
* 'node/1' => 'http://example.com/node/1',
* 'news' => 'http://example.com/news',
* );
*
* Example of array (when base url include option is disabled):
* array(
* 'node/1' => 'node/1',
* 'news' => 'news',
* );
*
* @param $wildcards
* Array with wildcards implementations.
* Array with wildcards implementations for each internal path.
* Indicates whether should be executed wildcard cache flush.
*
* Example:
* array(
* 'node/1' => FALSE,
* 'news' => TRUE,
* );
*
* @param $object_type
* Name of object type ('node', 'comment', 'user', etc).
*
......@@ -34,7 +52,19 @@ function hook_expire_cache($urls, $wildcards, $object_type, $object) {
* Provides possibility to change urls before they are expired.
*
* @param $urls
* List of internal paths or absolute URLs that should be flushed.
* List of internal paths and/or absolute URLs that should be flushed.
*
* Example of array (when base url include option is enabled):
* array(
* 'node/1' => 'http://example.com/node/1',
* 'news' => 'http://example.com/news',
* );
*
* Example of array (when base url include option is disabled):
* array(
* 'node/1' => 'node/1',
* 'news' => 'news',
* );
*
* @param $object_type
* Name of object type ('node', 'comment', 'user', etc).
......@@ -42,13 +72,10 @@ function hook_expire_cache($urls, $wildcards, $object_type, $object) {
* @param $object
* Object (node, comment, user, etc) for which expiration is executes.
*
* @param $absolute_urls_passed
* Indicates whether absolute URLs or internal paths were passed.
*
* @see expire.api.inc
*/
function hook_expire_cache_alter($urls, $object_type, $object, $absolute_urls_passed) {
if ($object_type == 'node' && !$absolute_urls_passed) {
function hook_expire_cache_alter(&$urls, $object_type, $object) {
if ($object_type == 'node') {
unset($urls['node-' . $object->nid]);
$urls['example'] = 'custom_page/' . $object->uid . '/' . $object->nid;
}
......
......@@ -24,9 +24,6 @@ class ExpireAPI {
*/
public static function executeExpiration($urls, $object_type = '', $object = NULL, $absolute_urls_passed = FALSE) {
// Allow other modules to modify the list prior to expiring.
drupal_alter('expire_cache', $urls, $object_type, $object, $absolute_urls_passed);
// Nothing to expire, so exit.
if (empty($urls)) {
return;
......@@ -71,6 +68,9 @@ class ExpireAPI {
}
}
// Allow other modules to modify the list prior to expiring.
drupal_alter('expire_cache', $urls, $object_type, $object);
// Write some debug information.
self::debugLog($urls, $wildcards, $object_type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment