You are here

function _drd_server_count_file in Drupal Remote Dashboard Server 7.2

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

Callback to determine the number of managed files and their size.

Parameters

boolean $status: If TRUE, only permanent files get considered, otherwise only temporary files.

Return value

array Associated array with a key 'count' containing the number of files and 'size' containing the size in bytes of all those files together.

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

File

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

Code

function _drd_server_count_file($status) {
  $count_query = db_select('file_managed');
  $count_query
    ->addExpression('COUNT(fid)', 'count');
  $count = $count_query
    ->condition('status', $status)
    ->execute()
    ->fetchField();
  $size_query = db_select('file_managed');
  $size_query
    ->addExpression('SUM(filesize)', 'size');
  $size = $size_query
    ->condition('status', $status)
    ->execute()
    ->fetchField();
  return array(
    'count' => $count,
    'size' => $size,
  );
}