protected function Requirements::checkRequestTracking in MongoDB 8.2
Check the consistency of request tracking vs configuration and environment.
Parameters
array $state: The current state of requirements.
Return value
array
- array: The current state of requirements checks.
- bool: true if the checks added an error, false otherwise
1 call to Requirements::checkRequestTracking()
- Requirements::check in modules/
mongodb_watchdog/ src/ Install/ Requirements.php - Implements hook_requirements().
File
- modules/
mongodb_watchdog/ src/ Install/ Requirements.php, line 180
Class
- Requirements
- Class Requirements implements hook_requirements().
Namespace
Drupal\mongodb_watchdog\InstallCode
protected function checkRequestTracking(array $state) : array {
$requestTracking = $this->config
->get('request_tracking');
if ($this
->hasUniqueId()) {
$state[Logger::MODULE] += $requestTracking ? [
'value' => $this
->t('Mod_unique_id available and used'),
'severity' => REQUIREMENT_OK,
'description' => $this
->t('Request tracking is available and active.'),
] : [
'value' => $this
->t('Unused mod_unique_id'),
'severity' => REQUIREMENT_INFO,
'description' => $this
->t('The site could track requests, but request tracking is not enabled. You could disable mod_unique_id to save resources, or enable request tracking</a> for a better logging experience.'),
];
return [
$state,
FALSE,
];
}
$state[Logger::MODULE] += [
'value' => $this
->t('No mod_unique_id'),
];
if ($requestTracking) {
if (php_sapi_name() === 'cli') {
$message = $this
->t('Request tracking is configured, but the site cannot check the working mod_unique_id configuration from the CLI. Be sure to validate configuration on the <a href=":report">status page</a>.', [
':report' => Url::fromRoute('system.status')
->toString(),
]);
$state[Logger::MODULE] += [
'severity' => REQUIREMENT_WARNING,
'description' => $message,
];
$this->messenger
->addWarning($message);
return [
$state,
FALSE,
];
}
$state[Logger::MODULE] += [
'severity' => REQUIREMENT_ERROR,
'description' => $this
->t('Request tracking is configured, but the site is not served by Apache with a working mod_unique_id.'),
];
return [
$state,
TRUE,
];
}
$state[Logger::MODULE] += [
'severity' => REQUIREMENT_OK,
'description' => $this
->t('Request tracking is not configured.'),
];
return [
$state,
FALSE,
];
}