You are here

function _acquia_purge_get_diagnosis_balancers in Acquia Purge 6

Test the amount of load balancers configured.

@returns Associative array with the following elements:

  • title: The name of the requirement.
  • value: The current value (e.g., version, time, level, etc).
  • description: The description of the requirement/status.
  • severity: ACQUIA_PURGE_SEVLEVEL_INFO, _OK, _WARNING, _ERROR

Parameters

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

File

./acquia_purge.diagnostics.inc, line 51
Self-test diagnostic test functions for _acquia_purge_get_diagnosis().

Code

function _acquia_purge_get_diagnosis_balancers($t) {
  $balancers = _acquia_purge_get_balancers();
  $balancers_c = count($balancers);
  $test = array(
    'value' => implode(', ', $balancers),
    'title' => $t('Load balancers'),
  );

  // Determine whether the amount of load balancers is healthy.
  if (!$balancers_c) {
    $test['value'] = $t('No load balancers detected.');
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_ERROR;
    $test['description'] = $t('There are no load balancers detected which makes' . ' it impossible to purge your site. Please contact Acquia Support!');
  }
  elseif ($balancers_c < 2) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
    $test['description'] = $t('You have only one load balancer, this means your' . ' site can not be failed over by us. Please contact Acquia Support.');
  }
  elseif ($balancers_c >= 6) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
    $test['description'] = $t('Your website is running behind @no load' . ' balancers, which will put severe stress on your database. Please pay' . ' attention to the number of items in the queue table.', array(
      '@no' => $balancers_c,
    ));
  }
  else {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_OK;
  }
  return $test;
}