function s3fs_requirements in S3 File System 7.2
Same name and namespace in other branches
- 8.3 s3fs.install \s3fs_requirements()
- 8.2 s3fs.install \s3fs_requirements()
- 7.3 s3fs.install \s3fs_requirements()
- 7 s3fs.install \s3fs_requirements()
- 4.0.x s3fs.install \s3fs_requirements()
Implements hook_requirements().
File
- ./
s3fs.install, line 11 - Install, update and uninstall functions for the S3 File System module.
Code
function s3fs_requirements($phase) {
$t = get_t();
if ($phase != 'runtime') {
return array();
}
if (ini_get('allow_url_fopen')) {
$requirements['s3fs_allow_url_fopen'] = array(
'severity' => REQUIREMENT_OK,
'title' => $t('allow_url_fopen'),
'value' => $t('Enabled'),
);
}
else {
$requirements['s3fs_allow_url_fopen'] = array(
'severity' => REQUIREMENT_ERROR,
'title' => $t('allow_url_fopen'),
'value' => $t('Disabled'),
'description' => $t('The S3 File System module requires that the allow_url_fopen setting be turned on in php.ini.'),
);
}
if (PHP_INT_SIZE === 8) {
$requirements['s3fs_int64'] = array(
'title' => $t('PHP architecture'),
'value' => $t('64-bit'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['s3fs_int64'] = array(
'title' => $t('PHP architecture'),
'value' => $t('32-bit'),
'description' => $t('A 64-bit PHP installation is required in order to support files larger than 2GB.'),
'severity' => REQUIREMENT_WARNING,
);
}
// Check for the Libraries module. This shouldn't really be needed, but if
// the user doesn't have Libraries, the error won't be reported correctly.
if (!module_exists('libraries')) {
$requirements['s3fs_libraries'] = array(
'title' => $t('Libraries module'),
'value' => $t('Not installed.'),
'description' => $t('S3 File System requires the Libraries module. Please install it from !here.', array(
'!here' => l('here', 'http://www.drupal.org/project/libraries'),
)),
'severity' => REQUIREMENT_ERROR,
);
// Return immediately, since we can't attempt to determine if AWS SDK 2
// is installed.
return $requirements;
}
$library = libraries_detect('awssdk2');
if ($library && !empty($library['installed'])) {
$requirements['s3fs_awssdk2'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('Installed @ v@version.', array(
'@version' => $library['version'],
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['s3fs_awssdk2'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('The S3 File System module requires the AWS SDK for PHP v2.x library.'),
'description' => $t('The Libraries module reported the following error: !error_message<br>
Please check the installation instructions for S3 File System.', array(
'!error_message' => filter_xss($library['error message']),
)),
'severity' => REQUIREMENT_ERROR,
);
}
if (_s3fs_get_setting('awssdk2_use_instance_profile')) {
$default_cache_config = _s3fs_get_setting('awssdk2_default_cache_config');
$message = array(
'title' => $t('AWS Instance Profile Cache'),
);
if (empty($default_cache_config) || !(is_writable($default_cache_config) && is_readable($default_cache_config))) {
$message['value'] = $t('The instance profile cache is NOT configured correctly in S3FS. It must be set to an
existing folder on the server, and the webserver must have read and write permissions on that folder.');
$message['severity'] = REQUIREMENT_ERROR;
}
else {
$message['value'] = $t('The instance profile cache setting in S3FS is configured correctly.');
$message['severity'] = REQUIREMENT_INFO;
}
$requirements['s3fs_default_cache_location_status'] = $message;
}
return $requirements;
}