You are here

function acquia_agent_watchdog in Acquia Connector 7.3

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

Implements hook_watchdog().

File

acquia_agent/acquia_agent.module, line 488
Acquia Agent securely sends information to Acquia Insight.

Code

function acquia_agent_watchdog($log_entry) {

  // Make sure that even when cron failures prevent hook_cron() from being
  // called, we still send out a heartbeat.
  $cron_failure_messages = array(
    'Cron has been running for more than an hour and is most likely stuck.',
    'Attempting to re-run cron while it is already running.',
  );
  if (in_array($log_entry['message'], $cron_failure_messages, TRUE)) {

    // Avoid doing this too frequently.
    $subscription = acquia_agent_settings('acquia_subscription_data');
    if (isset($subscription['timestamp']) && REQUEST_TIME - $subscription['timestamp'] >= 60 * 60) {
      acquia_agent_check_subscription();
    }
  }
}