| 1 |
<?php |
<?php |
| 2 |
|
// $Id: advcache.module,v 1.1.2.10 2009/02/26 13:02:45 mikejoconnor Exp $ |
| 3 |
|
|
| 4 |
function advcache_taxonomy($op, $type, $object=NULL) { |
function advcache_taxonomy($op, $type, $object=NULL) { |
| 5 |
if (is_null($object)) { |
if (is_null($object)) { |
| 11 |
case 'term': |
case 'term': |
| 12 |
$keys[] = 'term::'. $object['tid']; |
$keys[] = 'term::'. $object['tid']; |
| 13 |
if ($op == 'insert' || $op == 'delete' || $op == 'update') { |
if ($op == 'insert' || $op == 'delete' || $op == 'update') { |
| 14 |
cache_clear_all('tree::', 'cache_taxonomy', TRUE); |
cache_clear_all('*', 'cache_taxonomy', TRUE); |
| 15 |
if (module_exists('forum') && $object['vid'] == _forum_get_vid()) { |
if (module_exists('forum') && $object['vid'] == _forum_get_vid()) { |
| 16 |
cache_clear_all('*', 'cache_forum', TRUE); |
cache_clear_all('*', 'cache_forum', TRUE); |
| 17 |
} |
} |
| 48 |
switch ($op) { |
switch ($op) { |
| 49 |
case 'update': |
case 'update': |
| 50 |
case 'insert': |
case 'insert': |
| 51 |
case 'delete': |
case 'delete': |
| 52 |
global $user; |
cache_clear_all("node/{$node->nid}", 'cache_node'); |
| 53 |
$int = advcache_array2int($user->roles); |
|
|
if (!in_array($node->type, variable_get('advcache_node_exclude_types', array('poll')))) { |
|
|
$maxrole = pow(2, (int)db_result(db_query("SELECT MAX(rid) FROM {role}")) - 1); |
|
|
for ($i = 1; $i < $maxrole; $i++) { |
|
|
cache_clear_all($node->nid. '::'. $i, 'cache_node'); |
|
|
} |
|
|
} |
|
| 54 |
// It is unfortunate that we have to use the wildcard here, but it |
// It is unfortunate that we have to use the wildcard here, but it |
| 55 |
// comes from the fact that the signature to taxonomy_node_get_terms |
// comes from the fact that the signature to taxonomy_node_get_terms |
| 56 |
// has a $key parameter which goes into building the cache key, which |
// has a $key parameter which goes into building the cache key, which |
| 84 |
break; |
break; |
| 85 |
} |
} |
| 86 |
} |
} |
|
|
|
| 87 |
function advcache_devel_caches() { |
function advcache_devel_caches() { |
| 88 |
return array('cache_advcache_block', 'cache_node', 'cache_comment', 'cache_taxonomy', 'cache_path', 'cache_search', 'cache_forum'); |
return array('cache_advcache_block', 'cache_comment', 'cache_forum', 'cache_node', 'cache_path', 'cache_search', 'cache_taxonomy'); |
|
} |
|
|
|
|
|
function advcache_array2int($array) { |
|
|
$y = 0; |
|
|
foreach ($array as $k=> $v) { |
|
|
if (is_numeric($k)) { |
|
|
$y += pow(2, (int)$k - 2); |
|
|
} |
|
|
} |
|
|
return $y; |
|
| 89 |
} |
} |