function pmp_delete_guid_from_queue in Public Media Platform API Integration 7
Removes a GUID from the PMPAPI_DELETE_QUEUE DrupalQueue
Parameters
string $guid: A GUID.
2 calls to pmp_delete_guid_from_queue()
- pmpapi_increment_delete_tries in ./
pmpapi.module - Increments the number of delete tries for a given GUID
- pmpapi_remove in ./
pmpapi.module - Removes a doc from the PMP
File
- ./
pmpapi.module, line 154 - Creates basic calls to the PMP API.
Code
function pmp_delete_guid_from_queue($guid) {
$queue = DrupalQueue::get('PMPAPI_DELETE_QUEUE');
$unused_items = array();
$deleted_item = NULL;
// walk through the queue, if the GUID is already in the queue, remove it.
while ($item = $queue
->claimItem()) {
if (!empty($item->data['guid']) && $item->data['guid'] == $guid) {
$deleted_item = $item;
$queue
->deleteItem($item);
break;
}
else {
$unused_items[] = $item;
}
}
foreach ($unused_items as $item) {
$queue
->releaseItem($item);
}
return $deleted_item;
}