You are here

function acquia_spi_get_quantum in Acquia Connector 6

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()
  2. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_quantum()
  3. 7 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 157
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_result(db_query("SELECT COUNT(nid) FROM {node} WHERE status = 1"));

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

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