Commit a9e78c83 authored by Steve Rude's avatar Steve Rude

Fix for cache_clear_all issue in issue #199483. Combined patches posted by...

Fix for cache_clear_all issue in issue #199483.  Combined patches posted by Reg, firebus and robertDouglass.
Fixes both memcache.inc and memcache.db.inc.
parent b3ed35e8
......@@ -169,7 +169,16 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
// lifetime consideration (it handles it internally), and doesn't support
// wildcards.
$bin = empty($table) ? 'cache' : $table;
if (empty($cid) || $cid == '*') {
if (empty($cid) || ($cid == '*' && $wildcard !== TRUE)) {
# don't do anything if cid is unset. this matches the default drupal behavior...
if ($wildcard && $cid != '*') {
if (variable_get('memcache_debug', FALSE)) {
// call watchdog, since you probably didn't want to flush the entire bin.
watchdog('memcache', "illegal wildcard in cache_clear_all - not flushing entire bin. table: $table. cid: $cid", WATCHDOG_WARNING);
}
}
}
else if ($cid == '*' || $wildcard === TRUE) {
dmemcache_flush($table);
}
else {
......@@ -177,7 +186,7 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
}
if (!isset($cid) && !isset($table)) {
cache_clear_all(NULL, 'cache_page');
cache_clear_all('*', 'cache_page', TRUE);
return;
}
......
......@@ -85,7 +85,16 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
// lifetime consideration (it handles it internally), and doesn't support
// wildcards.
$bin = empty($table) ? 'cache' : $table;
if (empty($cid) || $cid == '*') {
if (empty($cid) || ($cid == '*' && $wildcard !== TRUE)) {
# don't do anything if cid is unset. this matches the default drupal behavior...
if ($wildcard && $cid != '*') {
if (variable_get('memcache_debug', FALSE)) {
// call watchdog, since you probably didn't want to flush the entire bin.
watchdog('memcache', "illegal wildcard in cache_clear_all - not flushing entire bin. table: $table. cid: $cid", WATCHDOG_WARNING);
}
}
}
else if ($cid == '*' || $wildcard === TRUE) {
dmemcache_flush($table);
}
else {
......
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