You are here

function _drd_server_count_session in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.module \_drd_server_count_session()

Callback to count number of sessions in a given period for either anonymous or authenticated users.

Parameters

int $timestamp: A Unix timestamp for the starting time from which the number of sessions should be counted until now.

boolean $anonymous: If TRUE, only sessions for anonymous users will be counted, otherwise only sessions for authenticated user sessions will be counted.

Return value

int The number of sessions being found.

1 call to _drd_server_count_session()
drd_server_heartbeat in ./drd_server.module
Callback to retrieve lots of current runtime data form the domain.

File

./drd_server.module, line 1224
Provides XMLRPC implementation to respond to requests from DRD.

Code

function _drd_server_count_session($timestamp = 0, $anonymous = TRUE) {
  $query = db_select('sessions');
  $query
    ->addExpression('COUNT(sid)', 'count');
  $query
    ->condition('timestamp', $timestamp, '>=');
  $query
    ->condition('uid', 0, $anonymous ? '=' : '>');
  return $query
    ->execute()
    ->fetchField();
}