You are here

function entity_modified_nodequeue_last in Entity modified 7

Retrieve the last time a nodequeue was modified.

@todo Re-factor main entity_modified code for it.

Parameters

string $nodequeue_name: The nodequeue to check for modification.

Return value

timestamp The last modified timestap of the nodequeue.

File

modules/entity_modified_nodequeue/entity_modified_nodequeue.module, line 66
Hook implementations and frequently used functions for entity modified - nodequeue module.

Code

function entity_modified_nodequeue_last($nodequeue_name) {
  $entity_type = 'entity_modified_nodequeue';
  $nodequeue = nodequeue_load_queue_by_name($nodequeue_name);
  $qid = $nodequeue->qid;
  $modified_timestamp = db_query('SELECT modified FROM {entity_modified} WHERE entity_type = :entity_type AND entity_id = :entity_id', array(
    ':entity_type' => $entity_type,
    ':entity_id' => $qid,
  ))
    ->fetchField();

  // If not found then use '1' as inserting something in a read-only operation
  // is a bad idea.
  if (!$modified_timestamp) {
    $modified_timestamp = 1;
  }
  return $modified_timestamp;
}