Browse Source

Added an EntityFieldQuery back to islandora_temp_file_entry.

pull/476/head
MorganDawe 11 years ago
parent
commit
dc1c337910
  1. 17
      includes/utilities.inc

17
includes/utilities.inc

@ -56,13 +56,22 @@ function islandora_convert_bytes_to_human_readable($bytes, $precision = 2) {
* The file, as returned from file_save(). * The file, as returned from file_save().
*/ */
function islandora_temp_file_entry($file_uri) { function islandora_temp_file_entry($file_uri) {
$file_name = drupal_basename($file_uri); $query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'file')
->propertyCondition('uri', $file_uri)
->execute();
if (isset($result['file'])) {
$fid = current($result['file'])->fid;
$file = file_load($fid);
}
else {
$file = new stdClass(); $file = new stdClass();
$file->uri = $file_uri; $file->uri = $file_uri;
$file->filename = drupal_basename($file_uri);
}
$file->status = 0; $file->status = 0;
// Save the temp file to be cleaned up later via cron. return file_save($file);
$return = file_save($file);
return $return;
} }
/** /**

Loading…
Cancel
Save