jonathangreen
13 years ago
1 changed files with 157 additions and 157 deletions
@ -1,157 +1,157 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
/** |
/** |
||||||
* @file fedora_repository.install |
* @file fedora_repository.install |
||||||
*/ |
*/ |
||||||
|
|
||||||
/** |
/** |
||||||
* Implementation of hook_enable(). |
* Implementation of hook_enable(). |
||||||
*/ |
*/ |
||||||
function fedora_collections_enable() { |
function fedora_collections_enable() { |
||||||
//nothing to do as we do not currently touch the drupal database. |
//nothing to do as we do not currently touch the drupal database. |
||||||
//other than the variables table |
//other than the variables table |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* Implementation of hook_requirements(). |
* Implementation of hook_requirements(). |
||||||
* |
* |
||||||
* @return |
* @return |
||||||
* An array describing the status of the site regarding available updates. |
* An array describing the status of the site regarding available updates. |
||||||
* If there is no update data, only one record will be returned, indicating |
* 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 |
* 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 |
* will be two records: one for core, and another for all of contrib |
||||||
* (assuming there are any contributed modules or themes enabled on the |
* (assuming there are any contributed modules or themes enabled on the |
||||||
* site). In addition to the fields expected by hook_requirements ('value', |
* site). In addition to the fields expected by hook_requirements ('value', |
||||||
* 'severity', and optionally 'description'), this array will contain a |
* 'severity', and optionally 'description'), this array will contain a |
||||||
* 'reason' attribute, which is an integer constant to indicate why the |
* 'reason' attribute, which is an integer constant to indicate why the |
||||||
* given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or |
* given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or |
||||||
* UPDATE_UNKNOWN). This is used for generating the appropriate e-mail |
* UPDATE_UNKNOWN). This is used for generating the appropriate e-mail |
||||||
* notification messages during update_cron(), and might be useful for other |
* notification messages during update_cron(), and might be useful for other |
||||||
* modules that invoke update_requirements() to find out if the site is up |
* modules that invoke update_requirements() to find out if the site is up |
||||||
* to date or not. |
* to date or not. |
||||||
* |
* |
||||||
* @see _update_message_text() |
* @see _update_message_text() |
||||||
* @see _update_cron_notify() |
* @see _update_cron_notify() |
||||||
*/ |
*/ |
||||||
function fedora_repository_requirements($phase) { |
function fedora_repository_requirements($phase) { |
||||||
global $base_url; |
global $base_url; |
||||||
|
|
||||||
$requirements = array(); |
$requirements = array(); |
||||||
|
|
||||||
if ($phase == 'install') { |
if ($phase == 'install') { |
||||||
|
|
||||||
// Test for SOAP |
// Test for SOAP |
||||||
$requirements['fedora-soap']['title'] = t("PHP SOAP extension library"); |
$requirements['fedora-soap']['title'] = t("PHP SOAP extension library"); |
||||||
if (!class_exists('SoapClient')) { |
if (!class_exists('SoapClient')) { |
||||||
$requirements['fedora-soap']['value'] = t("Not installed"); |
$requirements['fedora-soap']['value'] = t("Not installed"); |
||||||
$requirements['fedora-soap']['severity'] = REQUIREMENT_ERROR; |
$requirements['fedora-soap']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['fedora-soap']['description'] = t('Ensure that the PHP SOAP extension is installed.'); |
$requirements['fedora-soap']['description'] = t('Ensure that the PHP SOAP extension is installed.'); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['fedora-soap']['value'] = t("Installed"); |
$requirements['fedora-soap']['value'] = t("Installed"); |
||||||
$requirements['fedora-soap']['severity'] = REQUIREMENT_OK; |
$requirements['fedora-soap']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Test for Curl |
// Test for Curl |
||||||
$requirements['curl']['title'] = "PHP Curl extension library"; |
$requirements['curl']['title'] = "PHP Curl extension library"; |
||||||
if (!function_exists('curl_init')) { |
if (!function_exists('curl_init')) { |
||||||
$requirements['curl']['value'] = t("Not installed"); |
$requirements['curl']['value'] = t("Not installed"); |
||||||
$requirements['curl']['severity'] = REQUIREMENT_ERROR; |
$requirements['curl']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['curl']['description'] = t("Ensure that the PHP Curl extension is installed."); |
$requirements['curl']['description'] = t("Ensure that the PHP Curl extension is installed."); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['curl']['value'] = t("Installed"); |
$requirements['curl']['value'] = t("Installed"); |
||||||
$requirements['curl']['serenity'] = REQUIREMENT_OK; |
$requirements['curl']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Test for DOM |
// Test for DOM |
||||||
$requirements['dom']['title'] = "PHP DOM XML extension library"; |
$requirements['dom']['title'] = "PHP DOM XML extension library"; |
||||||
if (!method_exists('DOMDocument', 'loadHTML')) { |
if (!method_exists('DOMDocument', 'loadHTML')) { |
||||||
$requirements['dom']['value'] = t("Not installed"); |
$requirements['dom']['value'] = t("Not installed"); |
||||||
$requirements['dom']['severity'] = REQUIREMENT_ERROR; |
$requirements['dom']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['dom']['description'] = t("Ensure that the PHP DOM XML extension is installed."); |
$requirements['dom']['description'] = t("Ensure that the PHP DOM XML extension is installed."); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['dom']['value'] = t("Installed"); |
$requirements['dom']['value'] = t("Installed"); |
||||||
$requirements['dom']['serenity'] = REQUIREMENT_OK; |
$requirements['dom']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Test for XSLT |
// Test for XSLT |
||||||
$requirements['xsl']['title'] = "PHP XSL extension library"; |
$requirements['xsl']['title'] = "PHP XSL extension library"; |
||||||
if (!class_exists('XSLTProcessor')) { |
if (!class_exists('XSLTProcessor')) { |
||||||
$requirements['xslt']['value'] = t("Not installed"); |
$requirements['xslt']['value'] = t("Not installed"); |
||||||
$requirements['xslt']['severity'] = REQUIREMENT_ERROR; |
$requirements['xslt']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['xslt']['description'] = t("Ensure that the PHP XSL extension is installed."); |
$requirements['xslt']['description'] = t("Ensure that the PHP XSL extension is installed."); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['xslt']['value'] = t("Installed"); |
$requirements['xslt']['value'] = t("Installed"); |
||||||
$requirements['xslt']['serenity'] = REQUIREMENT_OK; |
$requirements['xslt']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Test for Imagick |
// Test for Imagick |
||||||
$requirements['imagick']['title'] = t("Image Magick library"); |
$requirements['imagick']['title'] = t("Image Magick library"); |
||||||
//if ( ! class_exists('Imagick') ) { |
//if ( ! class_exists('Imagick') ) { |
||||||
if (!file_exists('convert')) { |
if (!file_exists('convert')) { |
||||||
$requirements['imagick']['value'] = t("Not installed"); |
$requirements['imagick']['value'] = t("Not installed"); |
||||||
$requirements['imagick']['severity'] = REQUIREMENT_ERROR; |
$requirements['imagick']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['imagick']['description'] = t('Ensure that the Image Magick library is installed.'); |
$requirements['imagick']['description'] = t('Ensure that the Image Magick library is installed.'); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['imagick']['value'] = t("Installed"); |
$requirements['imagick']['value'] = t("Installed"); |
||||||
$requirements['imagick']['severity'] = REQUIREMENT_OK; |
$requirements['imagick']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Test for Kakadu |
// Test for Kakadu |
||||||
$requirements['kakadu']['title'] = t("Kakadu library"); |
$requirements['kakadu']['title'] = t("Kakadu library"); |
||||||
if (!file_exists('kdu_compress')) { |
if (!file_exists('kdu_compress')) { |
||||||
$requirements['kakadu']['value'] = t("Not installed"); |
$requirements['kakadu']['value'] = t("Not installed"); |
||||||
$requirements['kakadu']['severity'] = REQUIREMENT_ERROR; |
$requirements['kakadu']['severity'] = REQUIREMENT_ERROR; |
||||||
$requirements['kakadu']['description'] = t('Ensure that the Kakadu library is installed.'); |
$requirements['kakadu']['description'] = t('Ensure that the Kakadu library is installed.'); |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['kakadu']['value'] = t("Installed"); |
$requirements['kakadu']['value'] = t("Installed"); |
||||||
$requirements['kakadu']['severity'] = REQUIREMENT_OK; |
$requirements['kakadu']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
} |
} |
||||||
elseif ($phase == 'runtime') { |
elseif ($phase == 'runtime') { |
||||||
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); |
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); |
||||||
|
|
||||||
$requirements['fedora-repository']['title'] = t("Fedora server"); |
$requirements['fedora-repository']['title'] = t("Fedora server"); |
||||||
if (!fedora_available()) { |
if (!fedora_available()) { |
||||||
$requirements['fedora-repository']['value'] = t("Not available"); |
$requirements['fedora-repository']['value'] = t("Not available"); |
||||||
$requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; |
$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')); |
$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 { |
else { |
||||||
$requirements['fedora-repository']['value'] = t("Available"); |
$requirements['fedora-repository']['value'] = t("Available"); |
||||||
$requirements['fedora-repository']['severity'] = REQUIREMENT_OK; |
$requirements['fedora-repository']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
// Check for ImageMagick |
// Check for ImageMagick |
||||||
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH"); |
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH"); |
||||||
$result = exec('convert'); |
$result = exec('convert'); |
||||||
if (!$result) { |
if (!$result) { |
||||||
$requirements['fedora-imagemagick']['value'] = t('Not in $PATH'); |
$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']['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; |
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_WARNING; |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['fedora-imagemagick']['value'] = t("Available"); |
$requirements['fedora-imagemagick']['value'] = t("Available"); |
||||||
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_OK; |
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
|
|
||||||
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH'; |
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH'; |
||||||
$kdu_res = exec('kdu_compress -v'); |
$kdu_res = exec('kdu_compress -v'); |
||||||
if (!$kdu_res) { |
if (!$kdu_res) { |
||||||
$requirements['fedora-kakadu']['value'] = ('Not in $PATH'); |
$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']['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; |
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_WARNING; |
||||||
} |
} |
||||||
else { |
else { |
||||||
$requirements['fedora-kakadu']['value'] = t("Available"); |
$requirements['fedora-kakadu']['value'] = t("Available"); |
||||||
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_OK; |
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_OK; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
return $requirements; |
return $requirements; |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue