You are here

function acquia_spi_cron in Acquia Connector 7.3

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

Implements hook_cron().

File

acquia_spi/acquia_spi.module, line 41
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_cron() {

  // Don't send data if site is blocked or missing components.
  if (variable_get('acquia_spi_blocked', FALSE) || !variable_get('acquia_spi_site_name') && !variable_get('acquia_spi_site_machine_name')) {
    return;
  }

  // Get the last time we processed data.
  $last = variable_get('acquia_spi_cron_last', 0);

  // 30 minute interval for sending site profile.
  $interval = variable_get('acquia_spi_cron_interval', 30);

  // Allow an override.
  if (variable_get('acquia_spi_cron_interval_override', FALSE)) {
    $interval = variable_get('acquia_spi_cron_interval_override', 30);
  }

  // Determine if the required interval has passed.
  $now = REQUEST_TIME;
  if (variable_get('acquia_spi_use_cron', 1) && $now - $last > $interval * 60) {
    $ret = acquia_spi_send_full_spi(ACQUIA_SPI_METHOD_CRON);
  }
}