/[drupal]/contributions/modules/advcache/advcache.module
ViewVC logotype

Diff of /contributions/modules/advcache/advcache.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by robertDouglass, Mon Jul 9 19:42:26 2007 UTC revision 1.11 by mikejoconnor, Thu Feb 26 13:39:12 2009 UTC
# Line 1  Line 1 
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)) {
# Line 10  function advcache_taxonomy($op, $type, $ Line 11  function advcache_taxonomy($op, $type, $
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        }        }
# Line 47  function advcache_nodeapi($node, $op) { Line 48  function advcache_nodeapi($node, $op) {
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
# Line 89  function advcache_comment($a1, $op) { Line 84  function advcache_comment($a1, $op) {
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  }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.3