function s3fs_requirements in S3 File System 7
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.2 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 (!function_exists('libraries_detect')) {
$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,
);
}
// Report the version number of S3 File System on the system status page.
$requirements['s3fs_version'] = array(
'title' => $t('S3 File System'),
'value' => S3FS_VERSION,
'severity' => REQUIREMENT_OK,
);
return $requirements;
}