function 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

File

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

Code

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