Browse Source

Changed file delete logic.

pull/476/head
MorganDawe 11 years ago
parent
commit
c64d748765
  1. 13
      includes/utilities.inc

13
includes/utilities.inc

@ -82,20 +82,15 @@ function islandora_temp_file_entry($file_name, $file_uri) {
* TRUE if success, FALSE otherwise. * TRUE if success, FALSE otherwise.
*/ */
function islandora_temp_file_delete($file_uri) { function islandora_temp_file_delete($file_uri) {
$querya = new EntityFieldQuery(); $query = new EntityFieldQuery();
$result = $querya $result = $query
->entityCondition('entity_type', 'file') ->entityCondition('entity_type', 'file')
->propertyCondition('uri', $file_uri) ->propertyCondition('uri', $file_uri)
->execute(); ->execute();
$arr_keys = array_keys($result['file']); $arr_keys = array_keys($result['file']);
$file = file_load($arr_keys[0]); $file = file_load($arr_keys[0]);
file_delete($file); $success = file_delete($file);
$queryb = new EntityFieldQuery(); if ($success === FALSE) {
$resultb = $queryb
->entityCondition('entity_type', 'file')
->propertyCondition('uri', $file_uri)
->execute();
if (count($resultb) > 0) {
watchdog( watchdog(
'islandora', 'islandora',
'Failed to delete temp file %file.', 'Failed to delete temp file %file.',

Loading…
Cancel
Save