You are here

function hook_query_hosting_get_new_tasks_alter in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 task/hosting_task.api.php \hook_query_hosting_get_new_tasks_alter()

Alter the query that selects the next tasks to run.

You may use this hook to prioritise one type of task over another, or to prefer one client over another etc.

Parameters

QueryAlterableInterface $query: The structured query that will select the next tasks to run.

See also

hosting_get_new_tasks

Related topics

File

task/hosting_task.api.php, line 119
Hooks provided by the hosting tasks module.

Code

function hook_query_hosting_get_new_tasks_alter(QueryAlterableInterface $query) {

  // Change the sort ordering so that newer tasks are preferred to older ones.
  $order_by =& $query
    ->getOrderBy();
  $order_by['n.changed'] = 'DESC';
  $order_by['n.nid'] = 'DESC';
}