Browse Source

Adam's recommendations.

pull/341/head
Nigel Banks 12 years ago
parent
commit
4c90c17e5a
  1. 27
      islandora.module

27
islandora.module

@ -979,30 +979,17 @@ function islandora_copy_object(AbstractObject $object) {
$clone->$property = $object->$property; $clone->$property = $object->$property;
} }
} }
$datastream_properties = array(
'label',
'versionable',
'state',
'mimetype',
'format',
'size',
'checksum',
'checksumType',
'createdDate',
'content',
'url',
'location',
);
// Copy Datastreams. // Copy Datastreams.
foreach ($object as $dsid => $datastream) { foreach ($object as $dsid => $datastream) {
if (empty($clone[$dsid])) { if (empty($clone[$dsid])) {
$ds = $clone->constructDatastream($dsid, $datastream->controlGroup); $clone->ingestDatastream($datastream);
$clone->ingestDatastream($ds);
} }
foreach ($datastream_properties as $property) { else {
if (isset($object[$dsid]->$property)) { // Get the content into a file, and add the file.
$clone[$dsid]->$property = $object[$dsid]->$property; $temp_file = drupal_tempnam('temporary://', 'datastream');
} $datastream->getContent($temp_file);
$clone[$dsid]->setContentFromFile($temp_file);
drupal_unlink($temp_file);
} }
} }
return $clone; return $clone;

Loading…
Cancel
Save