CacheBinsDefault.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/CacheBinsDefault.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class CacheBinsDefault extends SiteAuditCheckBase {
public function getResultFail() {
}
public function getResultInfo() {
$ret_val = [
'#header' => [
'Bin',
'Class',
],
'#theme' => 'table',
];
foreach ($this->registry->cache_default_backends as $bin => $class) {
$ret_val['#rows'][] = [
$bin,
$class,
];
}
return $ret_val;
}
public function getResultPass() {
}
public function getResultWarn() {
}
public function getAction() {
}
public function calculateScore() {
$container = \Drupal::getContainer();
$defaults = $container
->getParameter('cache_default_bin_backends');
$this->registry->cache_default_backends = [];
foreach ($container
->getParameter('cache_bins') as $bin) {
if (isset($defaults[$bin])) {
$this->registry->cache_default_backends[$bin] = $defaults[$bin];
}
else {
$this->registry->cache_default_backends[$bin] = 'cache.backend.database';
}
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_INFO;
}
}