function s3fs_requirements in S3 File System 7.3
Same name and namespace in other branches
- 8.3 s3fs.install \s3fs_requirements()
- 8.2 s3fs.install \s3fs_requirements()
- 7 s3fs.install \s3fs_requirements()
- 7.2 s3fs.install \s3fs_requirements()
- 4.0.x s3fs.install \s3fs_requirements()
Implements hook_requirements().
File
- ./
s3fs.install, line 13 - 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 if Composer Manager module exists.
if (module_exists('composer_manager')) {
if (class_exists('Aws\\Sdk')) {
$requirements['s3fs_awssdk'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('AWS SDK is installed.'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['s3fs_awssdk'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('The S3 File System module requires the AWS SDK for PHP v3.x library.'),
'description' => $t('The AWS SDK could not be loaded.'),
'severity' => REQUIREMENT_ERROR,
);
}
}
elseif (module_exists('libraries')) {
$library = libraries_detect('awssdk');
if ($library && !empty($library['installed']) && version_compare($library['version'], '3') >= 0) {
$requirements['s3fs_awssdk'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('Installed @ v@version.', array(
'@version' => $library['version'],
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['s3fs_awssdk'] = array(
'title' => $t('AWS SDK for PHP'),
'value' => $t('The S3 File System module requires the AWS SDK for PHP v3.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,
);
}
}
else {
$requirements['s3fs_awssdk_manager'] = array(
'title' => $t('S3FS AWS SDK Management Tool'),
'value' => $t('Not installed.'),
'description' => $t('S3 File System requires either the Composer Manager or Libraries
module to manage the AWS SDK. Please install !composer_manager or !libraries.', array(
'!composer_manager' => l('Composer Manager', 'http://www.drupal.org/project/composer_manager'),
'!libraries' => l('Libraries', 'http://www.drupal.org/project/libraries'),
)),
'severity' => REQUIREMENT_ERROR,
);
}
if (_s3fs_get_setting('use_instance_profile')) {
$credentials_file = _s3fs_get_setting('credentials_file');
$message = array(
'title' => $t('AWS Custom Credentials File'),
);
if (empty($credentials_file) || !is_readable($credentials_file)) {
$message['value'] = $t('The credentials file is NOT configured correctly in S3FS. It must be set to an
existing folder on the server, and the webserver must have read permissions on that folder.');
$message['severity'] = REQUIREMENT_ERROR;
}
else {
$message['value'] = $t('The custom credentials file for S3FS is configured correctly.');
$message['severity'] = REQUIREMENT_INFO;
}
$requirements['s3fs_credentials_file_status'] = $message;
}
return $requirements;
}