You are here

function flag_flag::_decrease_count in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/flag/flag_flag.inc \flag_flag::_decrease_count()
  2. 7.2 flag.inc \flag_flag::_decrease_count()

Decreases the flag count for a piece of content.

@private

Parameters

$content_id: For which item should the count be descreased.

$number: The amount of counts to decrease. Defaults to 1.

1 call to flag_flag::_decrease_count()
flag_flag::_unflag in ./flag.inc
A low-level method to unflag content.

File

./flag.inc, line 820
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function _decrease_count($content_id, $number = 1) {
  $time = time();
  db_query("UPDATE {flag_counts} SET count = count - %d, last_updated = %d WHERE fid = %d AND content_id = %d", $number, $time, $this->fid, $content_id);

  // Delete rows with count 0, for data consistency and space-saving.
  db_query("DELETE FROM {flag_counts} WHERE fid = %d and content_id = %d AND count = %d", $this->fid, $content_id, 0);
}