You are here

function _expire_votingapi in Cache Expiration 7

Same name and namespace in other branches
  1. 6 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 525
Provides logic for page cache expiration

Code

function _expire_votingapi($votes) {
  foreach ($votes as $vote) {
    if ($vote['entity_type'] == 'comment') {
      $nid = db_query("SELECT nid FROM {comment} WHERE cid = :cid", array(
        ':cid' => $vote['entity_id'],
      ))
        ->fetchField();
      if (is_numeric($nid)) {
        $node = node_load($nid);
        if ($node) {
          expire_node($node);
        }
      }
    }
    if ($vote['entity_type'] == 'node') {
      $node = node_load($vote['entity_id']);
      if ($node) {
        expire_node($node);
      }
    }
  }
}