You are here

function flag_flag::_increase_count in Flag 7.2

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

Increases the flag count for a piece of content.

@private

Parameters

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

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

1 call to flag_flag::_increase_count()
flag_flag::_flag in ./flag.inc
A low-level method to flag content.

File

./flag.inc, line 854
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 _increase_count($content_id, $number = 1) {
  db_merge('flag_counts')
    ->key(array(
    'fid' => $this->fid,
    'content_id' => $content_id,
  ))
    ->fields(array(
    'content_type' => $this->content_type,
    'count' => $number,
    'last_updated' => REQUEST_TIME,
  ))
    ->updateFields(array(
    'last_updated' => REQUEST_TIME,
  ))
    ->expression('count', 'count + :inc', array(
    ':inc' => $number,
  ))
    ->execute();
}