Browse Source

Fixed some small issues including improper comments, not returning properly, unnecessary code and putting the file in temporary:// for safety.

pull/389/head
Christian Selig 12 years ago
parent
commit
9b04972ddb
  1. 10
      includes/datastream.version.inc
  2. 5
      theme/theme.inc

10
includes/datastream.version.inc

@ -143,7 +143,7 @@ function islandora_delete_datastream_version_form_submit(array $form, array &$fo
* @param AbstractDatastream $datastream * @param AbstractDatastream $datastream
* The datastream to be deleted. * The datastream to be deleted.
* @param string $version * @param string $version
* The version number of the datastream we are trying to delete. * The version number of the datastream we are trying to revert to.
* *
* @return array * @return array
* The drupal form definition. * The drupal form definition.
@ -169,11 +169,7 @@ function islandora_revert_datastream_version_form(array $form, array &$form_stat
/** /**
* Submit handler for the revert datastream form. * Submit handler for the revert datastream form.
* *
* Purges/Delete's the given AbstractDatastream if possible. * Reverts the given AbstractDatastream if possible.
*
* The ISLANDORA_PRE_PURGE_DATASTREAM_HOOK will query other modules as to
* whether the given FedoraDatastream
* should be: blocked from purging; state set to 'Deleted'; or purged.
* *
* @param array $form * @param array $form
* The Drupal form. * The Drupal form.
@ -192,7 +188,7 @@ function islandora_revert_datastream_version_form_submit(array $form, array &$fo
$datastream_to_revert->url = $datastream_to_revert_to->url; $datastream_to_revert->url = $datastream_to_revert_to->url;
} }
else { else {
$filename = file_create_filename('datastream_temp_file', '.'); $filename = file_create_filename('datastream_temp_file', 'temporary://');
$datastream_to_revert_to->getContent($filename); $datastream_to_revert_to->getContent($filename);
$datastream_to_revert->setContentFromFile($filename); $datastream_to_revert->setContentFromFile($filename);
file_unmanaged_delete($filename); file_unmanaged_delete($filename);

5
theme/theme.inc

@ -361,15 +361,12 @@ function theme_islandora_datastream_revert_link(array $vars) {
} }
$link = "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/version/{$vars['version']}/revert"; $link = "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/version/{$vars['version']}/revert";
} }
else {
$link = "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/revert";
}
if ($can_revert) { if ($can_revert) {
return l(t('revert'), $link); return l(t('revert'), $link);
} }
else { else {
''; return '';
} }
} }

Loading…
Cancel
Save