| 1 |
<?php |
<?php |
| 2 |
// $Id: content_refresh.module,v 1.8 2008/10/15 09:53:45 yaph Exp $ |
// $Id: content_refresh.module,v 1.9 2009/08/15 18:42:45 yaph Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 101 |
* Implementation of hook_comment(). |
* Implementation of hook_comment(). |
| 102 |
*/ |
*/ |
| 103 |
function content_refresh_comment($a1, $op) { |
function content_refresh_comment($a1, $op) { |
| 104 |
global $user; |
$nid = false; |
| 105 |
// check wheter user is anonymous |
$uid = false; |
| 106 |
if (0 == $user->uid) { |
switch ($op) { |
| 107 |
switch ($op) { |
case 'insert': |
| 108 |
case 'insert': |
case 'update': |
| 109 |
case 'update': |
$nid = $a1['nid']; |
| 110 |
$nid = $a1['nid']; |
$uid = $a1['uid']; |
| 111 |
break; |
break; |
| 112 |
case 'publish': |
case 'publish': |
| 113 |
case 'unpublish': |
case 'unpublish': |
| 114 |
case 'delete': |
case 'delete': |
| 115 |
$nid = $a1->nid; |
$nid = $a1->nid; |
| 116 |
break; |
$uid = $a1->uid; |
| 117 |
} |
break; |
| 118 |
if ($nid) { |
} |
| 119 |
// retrieve the absolute url for the node |
if ($nid !== false && 0 === $uid) { |
| 120 |
$options = array('absolute' => TRUE); |
// retrieve the absolute url for the node |
| 121 |
$url = url('node/'. $nid, $options); |
$options = array('absolute' => TRUE); |
| 122 |
// delete cache entries for that url |
$url = url('node/'. $nid, $options); |
| 123 |
cache_clear_all($url, 'cache_page'); |
// delete cache entries for that url |
| 124 |
} |
cache_clear_all($url, 'cache_page'); |
| 125 |
} |
} |
| 126 |
} |
} |