You are here

function hosting_task_outstanding in Hosting 7.3

Same name and namespace in other branches
  1. 5 task/hosting_task.module \hosting_task_outstanding()
  2. 6.2 task/hosting_task.module \hosting_task_outstanding()
  3. 7.4 task/hosting_task.module \hosting_task_outstanding()

Determine whether there is an outstanding task of a specific type.

This is used to ensure that there are not multiple tasks of the same type queued.

1 call to hosting_task_outstanding()
hosting_task_menu_access in task/hosting_task.module
Task access controls.

File

task/hosting_task.module, line 798
Web server node type is defined here.

Code

function hosting_task_outstanding($nid, $type) {
  $return = db_query("\n      SELECT t.nid FROM {hosting_task} t\n        INNER JOIN {node} n ON t.vid = n.vid\n      WHERE\n        t.rid = :rid\n        AND (t.task_status = :status_queued OR t.task_status = :status_processing)\n        AND t.task_type = :type\n        ORDER BY t.vid DESC\n        LIMIT 1", array(
    ':rid' => $nid,
    ':status_queued' => HOSTING_TASK_QUEUED,
    ':status_processing' => HOSTING_TASK_PROCESSING,
    ':type' => $type,
  ))
    ->fetchField();
  return $return;
}