You are here

function votingapi_delete_results in Voting API 6

Same name and namespace in other branches
  1. 6.2 votingapi.module \votingapi_delete_results()
  2. 7.2 votingapi.module \votingapi_delete_results()

Delete cached vote results from the database.

Parameters

$vote_results: An array of vote result objects to delete. Minimally, each object must have the vote_cache_id property set.

1 call to votingapi_delete_results()
votingapi_recalculate_results in ./votingapi.module
Loads all votes for a given piece of content, then calculates and caches the aggregate vote results. This is only intended for modules that have assumed responsibility for the full voting cycle: the votingapi_set_vote() function recalculates…

File

./votingapi.module, line 260

Code

function votingapi_delete_results($vote_results = array()) {
  if (!empty($vote_results)) {
    $vids = array();
    foreach ($vote_results as $vote) {
      $vids[] = $vote->vote_cache_id;
    }
    db_query("DELETE FROM {votingapi_cache} WHERE vote_cache_id IN (" . implode(',', array_fill(0, count($vids), '%d')) . ")", $vids);
  }
}