diff --git a/fedora_repository.module b/fedora_repository.module index 8d96500d..cfa48bc3 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1758,3 +1758,48 @@ function fedora_repository_display_schema($file) { } return; } + +/** + * Implementation of hook_requirements(). + * + * @return + * An array describing the status of the site regarding available updates. + * If there is no update data, only one record will be returned, indicating + * that the status of core can't be determined. If data is available, there + * will be two records: one for core, and another for all of contrib + * (assuming there are any contributed modules or themes enabled on the + * site). In addition to the fields expected by hook_requirements ('value', + * 'severity', and optionally 'description'), this array will contain a + * 'reason' attribute, which is an integer constant to indicate why the + * given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or + * UPDATE_UNKNOWN). This is used for generating the appropriate e-mail + * notification messages during update_cron(), and might be useful for other + * modules that invoke update_requirements() to find out if the site is up + * to date or not. + * + * @see _update_message_text() + * @see _update_cron_notify() + */ +function fedora_repository_requirements($phase) { + global $base_url; + if ($phase == 'runtime') { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + $requirement = array(); + $requirement['title'] = t("Fedora server"); + if (!fedora_available()) { + $requirement['value'] = ("Not available"); + $requirement['severity'] = REQUIREMENT_ERROR; + $requirement['description'] = t('Ensure that Fedora is running and that the collection settings are correct.', + array('@collection-settings' => $base_url.'/admin/settings/fedora_repository')); + } + else { + $requirement['value'] = ("Available"); + $requirement['severity'] = REQUIREMENT_OK; + } + + + } + $requirements = array(); + $requirements['fedora_available'] = $requirement; + return $requirements; +} \ No newline at end of file