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

Diff of /contributions/modules/content_refresh/content_refresh.module

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

revision 1.3, Fri Sep 5 22:25:54 2008 UTC revision 1.4, Fri Sep 5 22:46:14 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: content_refresh.module,v 1.3 2008/09/05 22:25:54 yaph Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 33  function content_refresh_nodeapi(&$node, Line 33  function content_refresh_nodeapi(&$node,
33    $cache_enabled = variable_get('cache', CACHE_DISABLED);    $cache_enabled = variable_get('cache', CACHE_DISABLED);
34    
35    if ($cache_enabled && $cache_lifetime > 0) {    if ($cache_enabled && $cache_lifetime > 0) {
36      $url = url('node/'. $node->nid, array('absolute' => TRUE));  
37      $clear_front = variable_get('content_refresh_clear_front_page_cache', 1);      $clear_front = FALSE;
38        $clear_page = FALSE;
39    
40      switch ($op) {      switch ($op) {
41        case 'insert':        case 'insert':
42            if ($node->status && $node->promote) {
43              $clear_front = TRUE;
44            }
45        case 'delete':        case 'delete':
46          // clear the front page cache_page entry if node is promoted          $clear_page = TRUE;
         // and published or deleted  
47          if ($node->status && $node->promote) {          if ($node->status && $node->promote) {
48            cache_clear_all($url, 'cache_page');            $clear_front = TRUE;
           if ($clear_front) {  
             content_refresh_clear_front_page_cache();  
           }  
49          }          }
50          break;          break;
51        case 'update':        case 'update':
         // clear the cache_page entry of the updated if it is published  
52          if ($node->status) {          if ($node->status) {
53            cache_clear_all($url, 'cache_page');            $clear_page = TRUE;
54              if ($node->promote) {
55                $clear_front = TRUE;
56              }
57          }          }
         // clear the front page cache_page entry if node is unpublished  
58          if (!$node->status && $node->promote) {          if (!$node->status && $node->promote) {
59             if ($clear_front) {            $clear_front = TRUE;
             content_refresh_clear_front_page_cache();  
           }  
60          }          }
61          break;          break;
62      }      }
63    
64        if ($clear_page) {
65          $url = url('node/'. $node->nid, array('absolute' => TRUE));
66          cache_clear_all($url, 'cache_page');
67        }
68    
69        if ($clear_front && variable_get('content_refresh_clear_front_page_cache', 1)) {
70          content_refresh_clear_front_page_cache();
71        }
72    }    }
73  }  }
74    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2