You are here

function acquia_spi_cron in Acquia Connector 6.2

Same name and namespace in other branches
  1. 6 acquia_spi/acquia_spi.module \acquia_spi_cron()
  2. 7.3 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()

Implementation of hook_cron().

File

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

Code

function acquia_spi_cron() {

  // 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 = time();
  if (variable_get('acquia_spi_use_cron', 1) && $now - $last > $interval * 60) {
    $ret = acquia_spi_send_full_spi(ACQUIA_SPI_METHOD_CRON);
  }
}