RegistryCheck.php in URLs queuer 8
File
src/Plugin/Purge/DiagnosticCheck/RegistryCheck.php
View source
<?php
namespace Drupal\purge_queuer_url\Plugin\Purge\DiagnosticCheck;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckBase;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckInterface;
use Drupal\purge_queuer_url\TrafficRegistryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class RegistryCheck extends DiagnosticCheckBase implements DiagnosticCheckInterface {
protected $registry;
public final function __construct(TrafficRegistryInterface $registry, array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->registry = $registry;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($container
->get('purge_queuer_url.registry'), $configuration, $plugin_id, $plugin_definition);
}
public function run() {
$this->value = $this->registry
->countUrls();
if ($this->value < 50) {
$this->recommendation = $this
->t("You need to spider your site to be able to queue URLs or paths, for example run: 'wget -r -nd --delete-after -l100 --spider http://site/'.");
return self::SEVERITY_WARNING;
}
elseif ($this->value > 7000) {
$this->recommendation = $this
->t("Your traffic database is huge, please consider tag based invalidation before your site becomes VERY slow!");
return self::SEVERITY_WARNING;
}
$this->recommendation = ' ';
return self::SEVERITY_OK;
}
}
Classes
Name |
Description |
RegistryCheck |
Tests if the URL queuer's traffic registry is in a healthy shape. |