You are here

function tmgmt_job_check_finished in Translation Management Tool 8

Same name and namespace in other branches
  1. 7 tmgmt.module \tmgmt_job_check_finished()

Checks whether a job is finished by querying the job item table for unfinished job items.

Parameters

$tjid: The identifier of the job.

Return value

bool TRUE if the job is finished, FALSE otherwise.

Related topics

3 calls to tmgmt_job_check_finished()
JobItem::abortTranslation in src/Entity/JobItem.php
Attempts to abort the translation job item.
JobItem::accepted in src/Entity/JobItem.php
Sets the state of the job item to 'accepted'.
JobItem::preDelete in src/Entity/JobItem.php
Acts on entities before they are deleted and before hooks are invoked.

File

./tmgmt.module, line 275
Main module file for the Translation Management module.

Code

function tmgmt_job_check_finished($tjid) {
  return !\Drupal::entityQuery('tmgmt_job_item')
    ->condition('tjid', $tjid)
    ->condition('state', [
    JobItem::STATE_ACCEPTED,
    JobItem::STATE_ABORTED,
  ], 'NOT IN')
    ->range(0, 1)
    ->count()
    ->execute();
}