You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
5.4 KiB
119 lines
5.4 KiB
<?php |
|
// $Id$ |
|
|
|
/** |
|
* @file fedora_repository.install |
|
*/ |
|
|
|
/** |
|
* Implementation of hook_enable(). |
|
*/ |
|
function fedora_collections_enable() { |
|
//nothing to do as we do not currently touch the drupal database. |
|
//other than the variables table |
|
} |
|
|
|
/** |
|
* 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; |
|
|
|
$requirements = array(); |
|
|
|
if ($phase == 'install') { |
|
$requirements['fedora-soap']['title'] = t("PHP SOAP extension library"); |
|
if (!class_exists('SoapClient')) { |
|
$requirements['fedora-soap']['value'] = t("Not installed"); |
|
$requirements['fedora-soap']['severity'] = REQUIREMENT_ERROR; |
|
$requirements['fedora-soap']['description'] = t('Ensure that the PHP SOAP extension is installed.'); |
|
} |
|
else { |
|
$requirements['fedora-soap']['value'] = t("Installed"); |
|
$requirements['fedora-soap']['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 <a href="@collection-settings">collection settings</a> are correct.', |
|
array('@collection-settings' => $base_url.'/admin/settings/fedora_repository')); |
|
} |
|
else { |
|
$requirements['fedora-repository']['value'] = t("Available"); |
|
$requirements['fedora-repository']['severity'] = REQUIREMENT_OK; |
|
} |
|
|
|
// Check for ImageMagick |
|
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH"); |
|
system('which convert', $res); |
|
if ($res != 0) { |
|
$requirements['fedora-imagemagick']['value'] = t('Not in $PATH'); |
|
$requirements['fedora-imagemagick']['description'] = t('Islandora will not be able to create thumbnails. Ensure that <a href="www.imagemagick.org/">ImageMagick</a> is installed and the convert command is executable by the web server user.'); |
|
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_WARNING; |
|
} |
|
else { |
|
$requirements['fedora-imagemagick']['value'] = t("Available"); |
|
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_OK; |
|
} |
|
|
|
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH'; |
|
system('which kdu_compress', $kdu_res); |
|
if ($kdu_res != 0) { |
|
$requirements['fedora-kakadu']['value'] = ('Not in $PATH'); |
|
$requirements['fedora-kakadu']['description'] = t('Islandora cannot convert TIFF image files to JPEG2000 format. Ensure <a href="http://www.kakadusoftware.com/">Kakadu</a> is installed and the kdu_compress command is executable by the web server user.'); |
|
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_WARNING; |
|
} |
|
else { |
|
$requirements['fedora-kakadu']['value'] = t("Available"); |
|
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_OK; |
|
} |
|
} |
|
|
|
return $requirements; |
|
} |
|
|
|
/** |
|
* Invokes a hook to any dependent modules asking them if their installations require |
|
* any fedora objects to be present. Modules implementing this hook should return an array |
|
* of arrays of the form: |
|
* |
|
* array( 'pid', 'path-to-foxml-file', 'dsid', 'path-to-datastream-file', int dsversion) |
|
* |
|
* where the last three options are optional. A module can either point to a simple |
|
* foxml file to install, or can specify a datastreamstream to check for, with a |
|
* path to load the datastream from if it isn't there. Optionally a version number |
|
* can be included, to enable updating of content model or collection policy streams |
|
* that may have been updated. THis is a simple whole number that should be incremented |
|
* when changed. This value appears in as an attribute of the topmost element of the stream, |
|
* e.g.,: |
|
* |
|
* <?xml version="1.0" encoding="utf-8"?> <content_model name="Collection" version="2" ... |
|
* |
|
* Datastreams which don't have this element are assumed to be at version 0. |
|
*/ |
|
function fedora_repository_check_for_required_fedora_objects() { |
|
$required_objects = module_invoke_all('required_fedora_objects'); |
|
} |