PageCacheCheck.php in Purge 8.3
File
src/Plugin/Purge/DiagnosticCheck/PageCacheCheck.php
View source
<?php
namespace Drupal\purge\Plugin\Purge\DiagnosticCheck;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class PageCacheCheck extends DiagnosticCheckBase implements DiagnosticCheckInterface {
protected $moduleHandler;
public final function __construct(ModuleHandlerInterface $module_handler, array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->moduleHandler = $module_handler;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($container
->get('module_handler'), $configuration, $plugin_id, $plugin_definition);
}
public function run() {
$this->value = $this
->t('installed');
if (!$this->moduleHandler
->moduleExists('page_cache')) {
$this->value = '';
$this->recommendation = $this
->t("Please install the page_cache module. The page cache acts as a 'second layer of defence' by keeping copies of all generated pages, which protects you from widespread performance degradation in case of emergencies.");
return self::SEVERITY_WARNING;
}
return self::SEVERITY_OK;
}
}