From fa569990643c0e29a42df7b73a78411b3361a1df Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Sat, 6 Apr 2013 17:17:20 -0300 Subject: [PATCH] Revert "Work around to handle the PHP-native stream wrappers." This reverts commit 54401f71e0d736b02e38dd8ad03c5d6bf9f58690. --- includes/utilities.inc | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 05c5320f..f061f72c 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -465,41 +465,20 @@ function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastr if (isset($ds['control_group']) && in_array($ds['control_group'], $groups)) { $control_group = $ds['control_group']; } - - $as_file = FALSE; + $ds_uri = FALSE; if (file_valid_uri($ds['datastream_file'])) { - // A local file with as a Drupal file/stream wrapper URI. $datastream_file = $ds['datastream_file']; - $as_file = TRUE; - } - elseif (is_readable($ds['datastream_file'])) { - // A local file as a filesystem path. - $datastream_file = drupal_realpath($ds['datastream_file']); - $as_file = TRUE; + $ds_uri = TRUE; } else { - $scheme = parse_url($ds['datastream_file'], PHP_URL_SCHEME); - if (in_array($scheme, stream_get_wrappers())) { - // A URI which gets handled by one of the PHP-native stream wrappers. - $datastream_file = $ds['datastream_file']; - $as_file = TRUE; - } - else { - // XXX: Dunno... No promises? Let's try to make a URL out of whatever - // this is. - $datastream_file = url($ds['datastream_file'], array('absolute' => TRUE)); - watchdog('islandora', 'Attempting to ingest %file in islandora_prepare_new_object(), but it does not appear to be readable. We will pass the path through url(), and pass along as such.', array( - '%file' => $datastream_file, - ), WATCHDOG_WARNING); - } + $datastream_file = url($ds['datastream_file'], array('absolute' => TRUE)); } - $datastream = $object->constructDatastream($dsid, $control_group); $datastream->label = $label; $datastream->mimetype = $mimetype; switch ($control_group) { case 'M': - if ($as_file) { + if ($ds_uri) { $datastream->setContentFromFile($datastream_file); } else { @@ -511,10 +490,8 @@ function islandora_prepare_new_object($namespace = NULL, $label = NULL, $datastr $datastream->setContentFromString(file_get_contents($datastream_file)); break; } - $object->ingestDatastream($datastream); } - return $object; }