diff --git a/fedora_repository.install b/fedora_repository.install index 0840e2e4..c4b3ad85 100644 --- a/fedora_repository.install +++ b/fedora_repository.install @@ -1,106 +1,134 @@ -collection settings are correct.', array('@collection-settings' => url('admin/settings/fedora_repository'))); - } - else { - $requirements['fedora-repository']['value'] = $t("Available"); - $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; - } - } - - return $requirements; -} + if (!method_exists('DOMDocument', 'loadHTML')) { + $requirements['dom']['value'] = $t("Not installed"); + $requirements['dom']['severity'] = REQUIREMENT_ERROR; + $requirements['dom']['description'] = $t("Ensure that the PHP DOM XML extension is installed."); + } + else { + $requirements['dom']['value'] = $t("Installed"); + $requirements['dom']['severity'] = REQUIREMENT_OK; + } + + // Test for XSLT + $requirements['xsl']['title'] = $t("PHP XSL extension library"); + if (!class_exists('XSLTProcessor')) { + $requirements['xslt']['value'] = $t("Not installed"); + $requirements['xslt']['severity'] = REQUIREMENT_ERROR; + $requirements['xslt']['description'] = $t("Ensure that the PHP XSL extension is installed."); + } + else { + $requirements['xslt']['value'] = $t("Installed"); + $requirements['xslt']['severity'] = REQUIREMENT_OK; + } + } + elseif ($phase == 'runtime') { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + + $requirements['fedora-repository']['title'] = $t("Fedora server"); + if (!fedora_available()) { + $requirements['fedora-repository']['value'] = $t("Not available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; + $requirements['fedora-repository']['description'] = $t('Ensure that Fedora is running and that the collection settings are correct.', array('@collection-settings' => url('admin/settings/fedora_repository'))); + } + else { + $requirements['fedora-repository']['value'] = $t("Available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; + } + } + + return $requirements; +} + +/** + * Implements hook_update_N(). + * + * This function will try and update the SOAP WSDLs + * as they were set wrong in previous releases. + */ +function fedora_repository_update_6001() { + // Get variables to check for update. + $API_A_WSDL = variable_get('fedora_soap_url', $default = NULL); + $API_M_WSDL = variable_get('fedora_soap_manage_url', $default = NULL); + + // Update API A if necessary. + $A_WSDL = parse_url($API_A_WSDL, PHP_URL_PATH) . '?' . parse_url($API_A_WSDL, PHP_URL_QUERY); + if ($A_WSDL == '/fedora/services/access?wsdl') { + variable_set('fedora_soap_url', str_replace('/fedora/services/access?wsdl', '/fedora/wsdl?api=API-A', $API_A_WSDL)); + } + + // Update API M if necessary. + $M_WSDL = parse_url($API_M_WSDL, PHP_URL_PATH) . '?' . parse_url($API_M_WSDL, PHP_URL_QUERY); + if ($M_WSDL == '/fedora/services/management?wsdl') { + variable_set('fedora_soap_manage_url', str_replace('/fedora/services/management?wsdl', '/fedora/wsdl?api=API-M', $API_M_WSDL)); + } + + return array( + array('success' => TRUE, 'query' => 'Please check your WSDL paths in Islandora\'s config, this update requires them to be set correctly: access; /fedora/wsdl?api=API-A, management; /fedora/wsdl?api=API-M'), + ); +}