You are here

function acquia_spi_get_quantum in Acquia Connector 7.3

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 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

array 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 1661
Send site profile information (NSPI) and system data to Acquia Insight.

Code

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

  // Get only published nodes.
  $quantum['nodes'] = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('n.status', NODE_PUBLISHED)
    ->countQuery()
    ->execute()
    ->fetchField();

  // Get only active users.
  $quantum['users'] = db_select('users', 'u')
    ->fields('u', array(
    'uid',
  ))
    ->condition('u.status', 1)
    ->countQuery()
    ->execute()
    ->fetchField();
  if (module_exists('comment')) {

    // Get only active comments.
    $quantum['comments'] = db_select('comment', 'c')
      ->fields('c', array(
      'cid',
    ))
      ->condition('c.status', COMMENT_PUBLISHED)
      ->countQuery()
      ->execute()
      ->fetchField();
  }
  return $quantum;
}