You are here

function _acquia_purge_diagnostics_backends_processor in Acquia Purge 7

Loaded processors.

Parameters

string $t: Name of the t() function to call.

AcquiaPurgeService $service: The Acquia Purge service.

Return value

array Associative array with the following elements:

1 string reference to '_acquia_purge_diagnostics_backends_processor'
acquia_purge_acquia_purge_diagnostics in ./acquia_purge.module
Implements hook_acquia_purge_diagnostics().

File

./acquia_purge.diagnostics.inc, line 292
Diagnostic self-tests and reports that aim to prevent runtime misery.

Code

function _acquia_purge_diagnostics_backends_processor($t, $service) {
  $test = array(
    'title' => $t('Loaded processors'),
    'value' => array(
      $t('Ajax'),
    ),
    'severity' => ACQUIA_PURGE_SEVLEVEL_INFO,
  );

  // Add tests for lateruntime and cron processing modes, when enabled.
  if (_acquia_purge_variable('acquia_purge_lateruntime')) {
    $test['value'][] = $t('Runtime');
  }
  if (_acquia_purge_variable('acquia_purge_cron')) {
    $test['value'][] = $t('Cron');

    // Raise a warning when it was too long ago since cron ran.
    $cron_last = variable_get('cron_last');
    if (!is_numeric($cron_last)) {
      $cron_last = variable_get('install_time', 0);
    }
    if (REQUEST_TIME - $cron_last > 3600) {
      $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
      $test['description'] = $t('It has been longer than one hour since cron ran' . ' for the last time, which puts your site at risk. As Acquia Purge' . ' has cron processing enabled, it assumes processing of its queue.' . ' When this is not frequent enough, the queue can reach dangerous' . ' levels and eventually even lead to a safety shutdown.');
    }
  }
  $test['value'] = implode(', ', $test['value']);
  return $test;
}