diff --git a/fedora_repository.module b/fedora_repository.module index 8820b4a0..a969369b 100644 --- a/fedora_repository.module +++ b/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'); diff --git a/formClass.inc b/formClass.inc index 5cfe17ef..9e63f7bc 100644 --- a/formClass.inc +++ b/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;