class JobDownload in TMGMT Extension Suite 8.3
Same name and namespace in other branches
- 8 src/Plugin/QueueWorker/JobDownload.php \Drupal\tmgmt_extension_suit\Plugin\QueueWorker\JobDownload
- 8.2 src/Plugin/QueueWorker/JobDownload.php \Drupal\tmgmt_extension_suit\Plugin\QueueWorker\JobDownload
Executes interface translation queue tasks.
Plugin annotation
@QueueWorker(
id = "tmgmt_extension_suit_download",
title = @Translation("Job translation download"),
cron = {"time" = 30}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\tmgmt_extension_suit\Plugin\QueueWorker\QueueWorkerLockedBase implements ContainerFactoryPluginInterface
- class \Drupal\tmgmt_extension_suit\Plugin\QueueWorker\JobDownload
- class \Drupal\tmgmt_extension_suit\Plugin\QueueWorker\QueueWorkerLockedBase implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of JobDownload
1 file declares its use of JobDownload
- QueueWorkerLockedTest.php in tests/
src/ Kernel/ QueueWorkerLockedTest.php
File
- src/
Plugin/ QueueWorker/ JobDownload.php, line 18
Namespace
Drupal\tmgmt_extension_suit\Plugin\QueueWorkerView source
class JobDownload extends QueueWorkerLockedBase {
/**
* {@inheritdoc}
*/
protected function doProcessItem(array $data) {
$tjid = isset($data['tjid']) ? $data['tjid'] : $data['id'];
$tjiid = isset($data['tjiid']) ? $data['tjiid'] : NULL;
try {
$job = Job::load($tjid);
$jobItem = NULL;
if (empty($job)) {
$this->logger
->error(t('Downloading translation for a job :job_id is failed: non-existent job. This job has been deleted from admin UI but queue item is still in the queue.', [
':job_id' => $tjid,
])
->render());
return;
}
if (!empty($tjiid)) {
$jobItem = Jobitem::load($tjiid);
if (empty($jobItem)) {
$this->logger
->error(t('Downloading translation for a job :job_id and jobItem :job_item_id is failed: non-existent job item. This job item has been deleted from admin UI but queue item is still in the queue.', [
':job_item_id' => $tjiid,
])
->render());
return;
}
}
$plugin = $job
->getTranslator()
->getPlugin();
if ($plugin instanceof ExtendedTranslatorPluginInterface && $plugin
->isReadyForDownload($job)) {
$plugin
->downloadTranslation($job, $jobItem);
}
} catch (\Exception $e) {
$this->logger
->error($e
->getMessage());
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JobDownload:: |
protected | function |
Hook method to be implemented in child classes. Overrides QueueWorkerLockedBase:: |
|
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. | |
QueueWorkerLockedBase:: |
protected | property | Lock service. | |
QueueWorkerLockedBase:: |
protected | property | Logger. | |
QueueWorkerLockedBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
QueueWorkerLockedBase:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
QueueWorkerLockedBase:: |
public | function |
Constructs a new LocaleTranslation object. Overrides PluginBase:: |