class LinkCheck in Link checker 8
Checks the link.
Plugin annotation
@QueueWorker(
id = "linkchecker_check",
title = @Translation("LinkChecker check"),
cron = {"time" = 240}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\linkchecker\Plugin\QueueWorker\LinkCheck implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of LinkCheck
File
- src/
Plugin/ QueueWorker/ LinkCheck.php, line 21
Namespace
Drupal\linkchecker\Plugin\QueueWorkerView source
class LinkCheck extends QueueWorkerBase implements ContainerFactoryPluginInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The link checker service.
*
* @var \Drupal\linkchecker\LinkCheckerService
*/
protected $linkChecker;
/**
* LinkExtract constructor.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, LinkCheckerService $linkChecker) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entityTypeManager;
$this->linkChecker = $linkChecker;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager'), $container
->get('linkchecker.checker'));
}
/**
* {@inheritdoc}
*/
public function processItem($data) {
$promises = [];
// Collect all request promises.
foreach ($data as $id) {
/** @var \Drupal\linkchecker\LinkCheckerLinkInterface $link */
$link = $this->entityTypeManager
->getStorage('linkcheckerlink')
->load($id);
if ($link) {
$promises[] = $this->linkChecker
->check($link);
}
}
// Force wait to complete of all requests
// to prevent next items of queue to be run.
Promise\settle($promises)
->wait();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LinkCheck:: |
protected | property | The entity type manager. | |
LinkCheck:: |
protected | property | The link checker service. | |
LinkCheck:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
LinkCheck:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
LinkCheck:: |
public | function |
LinkExtract constructor. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |