From 3b4e147b3198f466dcc1f9f31f0ffa5510cab97e Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Tue, 4 Jan 2011 13:17:32 -0400 Subject: [PATCH 1/4] Added Fedora availability check to the beginning of every repository item page load. --- fedora_repository.module | 4 ++++ plugins/pidfield/pidfield.module | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fedora_repository.module b/fedora_repository.module index 8d96500d..033c698e 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -757,6 +757,10 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); global $user; + if (!fedora_available()) { + return t('The Fedora repository server is currently unavailable. Please contact the site administrator.'); + } + if ($pid &!validPid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; diff --git a/plugins/pidfield/pidfield.module b/plugins/pidfield/pidfield.module index d9c475fc..63fb3311 100644 --- a/plugins/pidfield/pidfield.module +++ b/plugins/pidfield/pidfield.module @@ -277,11 +277,7 @@ function theme_pidfield_formatter_default($element) { $pid = $element['#item']['safe']; if(!empty($pid)) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item = new Fedora_Item($pid); - return fedora_repository_get_items($pid); - } return null; } From 026e8825b52db54446302f0ca1d22dd57d68eb40 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Tue, 4 Jan 2011 13:18:13 -0400 Subject: [PATCH 2/4] Removed commented out code. --- plugins/pidfield/pidfield.module | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/pidfield/pidfield.module b/plugins/pidfield/pidfield.module index 63fb3311..9b8ac508 100644 --- a/plugins/pidfield/pidfield.module +++ b/plugins/pidfield/pidfield.module @@ -273,9 +273,7 @@ function pidfield_field_formatter_info() { * */ function theme_pidfield_formatter_default($element) { - //return $element['#item']['safe']; $pid = $element['#item']['safe']; - if(!empty($pid)) { return fedora_repository_get_items($pid); } From 1db3998f6f5366111739052e1e4bd80a166c5fa7 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Mon, 10 Jan 2011 12:57:32 -0400 Subject: [PATCH 3/4] ISLANDORA-89\Changed display message to a warning in drupal_set_message, with repeat set to FALSE. --- fedora_repository.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fedora_repository.module b/fedora_repository.module index 033c698e..81056ef3 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -758,7 +758,8 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU global $user; if (!fedora_available()) { - return t('The Fedora repository server is currently unavailable. Please contact the site administrator.'); + drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE); + return ''; } if ($pid &!validPid($pid)) { From ddf5e3fc1884298b2f31c4bfd7b3b232b3e84ee5 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Mon, 10 Jan 2011 13:14:35 -0400 Subject: [PATCH 4/4] Remove use of SOAP in availability check. --- api/fedora_utils.inc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index 0e70af81..97612595 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -69,18 +69,8 @@ function fedora_available() { $ret = do_curl(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/management?wsdl'), 1); // A bit of a hack but the SOAP parser will cause a fatal error if you give it the wrong URL. + // PHP SOAP is now an installation requirement so this check is all we need to do. return (strpos($ret, 'wsdl:definitions') != FALSE); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $connection_helper = new ConnectionHelper(); - $soap_client = $connection_helper->getSoapClient( variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); - if (!empty($soap_client)) { - $result = $soap_client->__soapCall('describeRepository'); - echo $result; - } - else { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to get SOAP client connection.")); - return NULL; - } } /**