You are here

function _expire_votingapi in Cache Expiration 6

Same name and namespace in other branches
  1. 7 expire.module \_expire_votingapi()

Common expiry logic for votingapi.

2 calls to _expire_votingapi()
expire_votingapi_delete in ./expire.module
Implementation of hook_votingapi_delete().
expire_votingapi_insert in ./expire.module
Implementation of hook_votingapi_insert().

File

./expire.module, line 152
Provides logic for page cache expiration

Code

function _expire_votingapi($votes) {
  foreach ($votes as $vote) {
    if ($vote['content_type'] == 'comment') {
      $nid = db_result(db_query("SELECT nid FROM {comments} WHERE cid = %d", $vote['content_id']));
      if (is_numeric($nid)) {
        $node = node_load($nid);
        if ($node) {
          expire_node($node);
        }
      }
    }
    if ($vote['content_type'] == 'node') {
      $node = node_load($vote['content_id']);
      if ($node) {
        expire_node($node);
      }
    }
  }
}