You are here

function _acquia_purge_diagnostics_inv_schemes in Acquia Purge 7

Invalidated schemes.

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_inv_schemes'
acquia_purge_acquia_purge_diagnostics in ./acquia_purge.module
Implements hook_acquia_purge_diagnostics().

File

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

Code

function _acquia_purge_diagnostics_inv_schemes($t, $service) {
  $schemes = $service
    ->hostingInfo()
    ->getSchemes();
  $test = array(
    'title' => $t('Invalidated schemes'),
    'value' => strtoupper(implode(', ', $schemes)),
  );

  // Test if no protocol schemes are to be invalidated.
  if (empty($schemes)) {
    $test['value'] = $t('None');
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_ERROR;
    $test['description'] = $t('It seems as if you have put both ' . ' <b>acquia_purge_http</b> and <b>acquia_purge_https</b> settings to' . ' <b>FALSE</b> and thus disabled, which leads to a situation' . ' that does not work. Enable either one of them for Acquia Purge' . ' to continue to operate.');
  }
  elseif (count($schemes) === 1) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_OK;
  }
  elseif (count($schemes) === 2 && count($service
    ->hostingInfo()
    ->getDomains()) > 4) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_ERROR;
    $test['description'] = $t('You are clearing both <b>http://</b> as' . ' <b>https://</b> paths on your site with more than 4 domain names.' . ' Acquia Purge has self-shutdown to prevent worse from happening as' . ' two protocol schemes with this many domain names can likely bring' . ' down your website at some point. Its better to either only wipe' . ' https:// or by reducing unnecessary domain names, for instance' . ' bare domains that redirect. See INSTALL.md and DOMAINS.md for more' . ' information on tuning.');
  }
  elseif (count($schemes) === 2) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
    $test['description'] = $t('You are clearing both <b>http://</b> as' . ' <b>https://</b> paths on your site, which can be dangerous. Especially' . ' if you have more than 1-2 domains as this will lead in the double' . ' amount of work that gets done. Keep a close eye on the queue and' . ' consider delivering all your traffic off https:// (by doing a full' . ' -site redirect) and to disable http:// clearing, see INSTALL.md.');
  }
  return $test;
}