You are here

function nodequeue_check_subqueue_size in Nodequeue 5.2

Same name and namespace in other branches
  1. 6.2 nodequeue.module \nodequeue_check_subqueue_size()
  2. 7.3 nodequeue.module \nodequeue_check_subqueue_size()
  3. 7.2 nodequeue.module \nodequeue_check_subqueue_size()

Guarantee that a subqueue has not gotten too big. It's important to call this after an operation that might have reduced a queue's maximum size. It stores the count to save a query if this is to be followed by an add operation.

Parameters

$queue: The queue object.

$reference: The subqueue to check.

3 calls to nodequeue_check_subqueue_size()
nodequeue_arrange_subqueue_form_submit in ./nodequeue.module
Submit function for nodequeue_arrange_subqueue_form
nodequeue_check_subqueue_sizes in ./nodequeue.module
Guarantee that all subqueues are within the size constraints set by $queue->size.
nodequeue_subqueue_add in ./nodequeue.module
Add a node to a queue.

File

./nodequeue.module, line 1966

Code

function nodequeue_check_subqueue_size($queue, &$subqueue, $size = NULL) {
  if (!isset($size)) {
    $size = $queue->size;
  }
  if ($queue->size && $subqueue->count > $size) {
    nodequeue_subqueue_remove($subqueue->sqid, 1, $subqueue->count - $size);
    $subqueue->count = $size;
  }
}