BestPracticesSettings.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/BestPracticesSettings.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class BestPracticesSettings extends SiteAuditCheckBase {
public function getResultFail() {
}
public function getResultInfo() {
}
public function getResultPass() {
return $this
->t('settings.php exists and is not a symbolic link.');
}
public function getResultWarn() {
return $this
->t('sites/default/settings.php is a symbolic link.');
}
public function getAction() {
if ($this->score == SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN) {
return $this
->t('Don\'t rely on symbolic links for core configuration files; copy settings.php where it should be and remove the symbolic link.');
}
if ($this->score == SiteAuditCheckBase::AUDIT_CHECK_SCORE_FAIL) {
return $this
->t('Even if environment settings are injected, create a stub settings.php file for compatibility.');
}
}
public function calculateScore() {
if (file_exists(DRUPAL_ROOT . '/sites/default/settings.php')) {
if (is_link(DRUPAL_ROOT . '/sites/default/settings.php')) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_FAIL;
}
}