Additional error handling, and add wrapp for modifyDatastream
Wrapping allows either content or a file to be pushed, independant of the
controlGroup... You don't have to know if you need to push by value or
reference!
drupal_set_message("$datastream_file not found<br/>", 'warning');
drupal_set_message(t('The datastream file %datastream_file could not found! (or is not a regular file...)', array('%datastream_file' => $datastream_file)), 'warning');
return;
}
elseif (!is_readable($datastream_file)) {
drupal_set_message(t('The datastream file %datastream_file could not be read! (likely due to permissions...)', array('%datastream_file' => $datastream_file)), 'warning');
return;
}
if (empty($datastream_mimetype)) {
// Get mime type from the file extension.
$mimetype_helper = new MimeClass();
@ -434,7 +439,7 @@ RDF;
* @param type $as_of_date_time
* @return type
*/
function get_datastream($dsid, $as_of_date_time = "") {
function get_datastream($dsid, $as_of_date_time = '') {
$params = array(
'pid' => $this->pid,
'dsID' => $dsid,
@ -530,7 +535,7 @@ RDF;
* @return datastream object
* get the mimetype size etc. in one shot. instead of iterating throught the datastream list for what we need
*/
function get_datastream_info($dsid, $as_of_date_time = "") {
function get_datastream_info($dsid, $as_of_date_time = '') {
$params = array(
'pid' => $this->pid,
'dsID' => $dsid,
@ -563,7 +568,7 @@ RDF;
// datastream, instead of returning it as an array, only
// the single item will be returned directly. We have to
// check for this.
if (count($this->datastreams_list->datastreamDef) >= 2) {
if (count($this->datastreams_list->datastreamDef) > 1) {
foreach ($this->datastreams_list->datastreamDef as $ds) {