You are here

function acquia_spi_get_quantum in Acquia Connector 7

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()
  2. 6 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()
  3. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()
  4. 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()

Gather information about nodes, users and comments.

Return value

An associative array.

1 call to acquia_spi_get_quantum()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 155
Send site profile information (SPI) and system data to Acquia Network.

Code

function acquia_spi_get_quantum() {
  $quantum = array();

  // Get only published nodes.
  $quantum['nodes'] = db_query("SELECT COUNT(nid) FROM {node} WHERE status = 1")
    ->fetchField();

  // Get only active users.
  $quantum['users'] = db_query("SELECT COUNT(uid) FROM {users} WHERE status = 1")
    ->fetchField();

  // Get only active comments. NOTE: in case of comments, 0 is the active comment!
  if (module_exists('comment')) {
    $quantum['comments'] = db_query("SELECT COUNT(cid) FROM {comment} WHERE status = :comment_constant", array(
      ':comment_constant' => COMMENT_PUBLISHED,
    ))
      ->fetchField();
  }
  else {
    $quantum['comments'] = 0;
  }
  return $quantum;
}