function pmpapi_increment_delete_tries in Public Media Platform API Integration 7
Increments the number of delete tries for a given GUID
Parameters
string $guid: A GUID.
1 call to pmpapi_increment_delete_tries()
- pmpapi_remove in ./
pmpapi.module - Removes a doc from the PMP
File
- ./
pmpapi.module, line 182 - Creates basic calls to the PMP API.
Code
function pmpapi_increment_delete_tries($guid) {
$queue = DrupalQueue::get('PMPAPI_DELETE_QUEUE');
$deleted_item = pmp_delete_guid_from_queue($guid);
$tries = !empty($deleted_item->data['tries']) ? $deleted_item->data['tries'] + 1 : 1;
// Queue the GUID so we can delete it later
if ($tries < 3) {
$fresh_item = array(
'guid' => $guid,
'tries' => $tries,
);
$queue
->createItem($fresh_item);
}
else {
watchdog('pmpapi_increment_delete_tries', 'Failed to be able to delete doc from the PMP [GUID=' . $guid . ' ] after three tries. Removing GUID from queue.');
}
}