Browse Source

Added check for iiv viewer.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
7c1f789139
  1. 47
      ilives/fedora_ilives.module

47
ilives/fedora_ilives.module

@ -593,5 +593,52 @@ function install_book_content_model_objects() {
if (!Fedora_Item::fedora_item_exists('ilives:CollectionModel')) { if (!Fedora_Item::fedora_item_exists('ilives:CollectionModel')) {
Fedora_Item::ingest_from_foxml_file(drupal_get_path('module', 'fedora_ilives') . '/xml/ilives_CollectionModel.xml'); Fedora_Item::ingest_from_foxml_file(drupal_get_path('module', 'fedora_ilives') . '/xml/ilives_CollectionModel.xml');
} }
}
/**
* 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_ilives_requirements($phase) {
global $base_url;
if ($phase == 'runtime') {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$requirements['iiv-war'] = array();
$requirements['iiv-war']['title'] = t("Islandora OpenLayers image viewer web app");
if (!_fedora_ilives_viewer_available()) {
$requirements['iiv-war']['value'] = ("Not available");
$requirements['iiv-war']['severity'] = REQUIREMENT_ERROR;
$requirements['iiv-war']['description'] = t('Ensure that Fedora is running and that the <a href="@iiv-home">IIV</a> app is deployed.',
array('@iiv-home' => 'http://github.com/islandora/iiv'));
}
else {
$requirements['iiv-war']['value'] = ("Available");
$requirements['iiv-war']['severity'] = REQUIREMENT_OK;
}
}
return $requirements;
}
function _fedora_ilives_viewer_available() {
$url = parse_url(variable_get('fedora_base_url', 'http://localhost:8080/fedora'));
$fedora_host = ("{$url['scheme']}://{$url['host']}" . (!empty($url['port']) ? ":{$url['port']}/" : '/'));
$response = drupal_http_request("$fedora_host/iiv/images/loading.gif");
return empty($response->error);
} }
Loading…
Cancel
Save