Browse Source

Change the way we checked for ISLANDORACM datastream to take some strain off the logs

pull/44/head
Alan Stanley 13 years ago
parent
commit
632de8f9f0
  1. 17
      api/fedora_utils.inc

17
api/fedora_utils.inc

@ -6,7 +6,6 @@
* @file * @file
* Base utilities used by the Islandora fedora module. * Base utilities used by the Islandora fedora module.
*/ */
if (!function_exists('str_getcsv')) { if (!function_exists('str_getcsv')) {
/** /**
@ -98,7 +97,6 @@ function do_curl_ext($url, $return_to_variable = 1, $number_of_post_vars = 0, $p
global $user; global $user;
// Check if we are inside Drupal and there is a valid user. // Check if we are inside Drupal and there is a valid user.
// If the user is not valid for a Fedora call curl will throw an exception. // If the user is not valid for a Fedora call curl will throw an exception.
if ((!isset($user)) || $user->uid == 0) { if ((!isset($user)) || $user->uid == 0) {
$fedora_user = 'anonymous'; $fedora_user = 'anonymous';
@ -131,9 +129,8 @@ function do_curl_ext($url, $return_to_variable = 1, $number_of_post_vars = 0, $p
$error_code = curl_errno($ch); $error_code = curl_errno($ch);
$error_string = curl_error($ch); $error_string = curl_error($ch);
return array ($ret_val, $error_code, $error_string); return array($ret_val, $error_code, $error_string);
} }
else { else {
if (function_exists(drupal_set_message)) { if (function_exists(drupal_set_message)) {
drupal_set_message(t('No curl support.'), 'error'); drupal_set_message(t('No curl support.'), 'error');
@ -159,10 +156,9 @@ function fedora_available() {
function risearch_available() { function risearch_available() {
$response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch')); $response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'));
return ($response != NULL) ? ($response[1] == 0): FALSE; return ($response != NULL) ? ($response[1] == 0) : FALSE;
} }
/** /**
* Returns a UTF-8-encoded transcripiton of the string given in $in_str. * Returns a UTF-8-encoded transcripiton of the string given in $in_str.
* @param string $in_str * @param string $in_str
@ -264,7 +260,7 @@ function get_collections_as_option_array() {
/** /**
* Function: get_content_models_as_option_array * Function: get_content_models_as_option_array
* *
* Description: Returns an associative array of all collection objects in Fedora instance * Description: Returns an associative array of all available content models in Fedora instance
* *
* @return array * @return array
*/ */
@ -298,9 +294,10 @@ function get_content_models_as_option_array() {
$item = new fedora_item($parts[0]); $item = new fedora_item($parts[0]);
$nameparts = explode(':', $parts[0]); $nameparts = explode(':', $parts[0]);
if (!$restricted || in_array($nameparts[0], $allowed)) if (!$restricted || in_array($nameparts[0], $allowed))
if ($item->get_datastream_dissemination('ISLANDORACM')) { $datastreams = array_keys($item->get_datastreams_list_as_array());
$options[$parts[0]] = $parts[1]. ' ~ ' . $parts[0] ; if (in_array('ISLANDORACM', $datastreams)) {
} $options[$parts[0]] = $parts[1] . ' ~ ' . $parts[0];
}
} }
} }

Loading…
Cancel
Save