BestPracticesFast404.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/BestPracticesFast404.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class BestPracticesFast404 extends SiteAuditCheckBase {
public function getResultFail() {
}
public function getResultInfo() {
}
public function getResultPass() {
return $this
->t('Fast 404 pages are enabled.');
}
public function getResultWarn() {
return $this
->t('Fast 404 pages are not enabled for any path.');
}
public function getAction() {
if ($this->score == SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN) {
return $this
->t('See https://git.drupalcode.org/project/drupal/-/blob/9.1.x/sites/default/default.settings.php#L617-642 for details on how to implement, <a href="https://support.hypernode.com/en/best-practices/performance/how-to-set-up-smart-404-handling">unless this is already being done by your Web server</a> (e.g. Aegir with Nginx).');
}
}
public function calculateScore() {
$config = \Drupal::config('system.performance');
if ($config
->get('fast_404.enabled') && trim($config
->get('fast_404.paths')) != '') {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN;
}
}