Browse Source

Merge pull request #242 from ajstanley/6.x

added additional error trapping
pull/245/merge
ajstanley 12 years ago
parent
commit
5095bc1fca
  1. 23
      fedora_repository.module
  2. 4
      formClass.inc

23
fedora_repository.module

@ -1784,7 +1784,7 @@ function islandora_callback_prep() {
}
function islandora_fedora_settings_form_submit($form, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
if ($form_state['ahah_submission'] == TRUE) {
$form_state['rebuild'] = TRUE;
@ -1814,9 +1814,15 @@ function islandora_fedora_settings_form_submit($form, &$form_state) {
//set elements previously defined in config code.
//the elements are left in to allow for third party modules.
if ($op != t('Reset to defaults')) {
$fedora_base = variable_get('fedora_base_url', 'http://localhost:8080/fedora');
variable_set('fedora_soap_url', $fedora_base . '/wsdl?api=API-A');
variable_set('fedora_soap_manage_url', $fedora_base . '/wsdl?api=API-M');
$fedora_path = variable_get('fedora_base_url', 'http://localhost:8080/fedora');
$response = do_curl_ext($fedora_path . '/describe');
$available = ($response != NULL) ? ($response[1] == 0) : FALSE;
if ($available) {
variable_set('fedora_soap_url', $fedora_path . '/wsdl?api=API-A');
variable_set('fedora_soap_manage_url', $fedora_path . '/wsdl?api=API-M');
$root = variable_get('fedora_repository_pid', 'islandora:root');
islandora_guarantee_root_collection($root);
}
}
if ($op == t('Reset to defaults')) {
drupal_set_message(t('The configuration options have been reset to their default values.'));
@ -1825,8 +1831,7 @@ function islandora_fedora_settings_form_submit($form, &$form_state) {
drupal_set_message(t('The Islandora configuration options have been saved.'));
}
$root = variable_get('fedora_repository_pid', 'islandora:root');
islandora_guarantee_root_collection($root);
cache_clear_all();
drupal_rebuild_theme_registry();
}
@ -1834,13 +1839,9 @@ function islandora_fedora_settings_form_submit($form, &$form_state) {
function islandora_guarantee_root_collection($pid) {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if(!fedora_available ()){
drupal_set_message(t('Fedora is not available'));
return;
}
$item = new Fedora_Item($pid);
if ($item->exists()) {
return;
}
$item = Fedora_item::ingest_new_item($pid, 'A', 'Islandora Root Collection', 'admin');

4
formClass.inc

@ -180,6 +180,10 @@ class formClass {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$fedora_path = isset($form_state['values']['fedora_base_url']) ? $form_state['values']['fedora_base_url'] : variable_get('fedora_base_url', 'http://localhost:8080/fedora');
$parts = @parse_url($fedora_path);
if($parts &!isset($parts['scheme'])){
$fedora_path = "http://" . $fedora_path;
}
$triplepath = "$fedora_path/risearch";
$response = do_curl_ext($fedora_path . '/describe');
$available = ($response != NULL) ? ($response[1] == 0) : FALSE;

Loading…
Cancel
Save