function awssdk_requirements in AWS SDK for PHP 7.5
Same name and namespace in other branches
- 7.3 awssdk.module \awssdk_requirements()
- 7.4 awssdk.module \awssdk_requirements()
Implements hook_requirements()
1 call to awssdk_requirements()
- AWSSDKUnitTest::testLibrary in ./
awssdk.test - Ensure that AWS SDK libraries integration and configuration work properly.
File
- ./
awssdk.module, line 45 - Provides primary Drupal hook implementations.
Code
function awssdk_requirements($phase) {
$t = get_t();
$requirements = array();
// None of these requirements are relevant outside of runtime.
if ($phase != 'runtime') {
return $requirements;
}
$info = libraries_load('awssdk');
if (!$info['loaded']) {
$requirements['awssdk'] = array(
'severity' => REQUIREMENT_ERROR,
'title' => $t('AWSSDK'),
'value' => $t('Failed to load the AWSSDK'),
'description' => $t('Please make sure the AWSSDK library is installed in the libraries directory. Use the drush make file for easy installation.'),
);
}
else {
if (!$info['version'] || version_compare($info['version'], AWSSDK_MINIMUM_VERSION) < 0) {
$requirements['awssdk'] = array(
'severity' => REQUIREMENT_ERROR,
'title' => $t('AWSSDK'),
'value' => $info['version'] . ' [' . l(t('compatibility test'), 'admin/reports/awssdk') . ']',
'description' => $t('Please make sure the AWSSDK library installed is ' . AWSSDK_MINIMUM_VERSION . ' or greater.'),
);
}
else {
global $base_url;
$requirements['awssdk'] = array(
'severity' => REQUIREMENT_OK,
'title' => $t('AWSSDK'),
'value' => $info['version'] . ' [' . l(t('compatibility test'), 'admin/reports/awssdk') . ']',
);
// Check for SDK compatibility.
include $info['library path'] . '/_compatibility_test/sdk_compatibility.inc.php';
if ($compatiblity == REQUIREMENTS_NOT_MET) {
$requirements['awssdk']['severity'] = REQUIREMENT_ERROR;
$requirements['awssdk']['description'] = $t('Your PHP environment does not support the minimum requirements for the AWS SDK for PHP.');
}
elseif (!CFCredentials::get()->key || !CFCredentials::get()->secret) {
$requirements['awssdk']['severity'] = REQUIREMENT_ERROR;
$requirements['awssdk']['description'] = $t('The required AWSSDK credentials key and secret have not been set.');
// Add link to configuration form if ui is enabled.
if (module_exists('awssdk_ui')) {
$requirements['awssdk']['description'] .= ' [' . l(t('configuration'), 'admin/config/media/awssdk') . ']';
}
}
}
}
return $requirements;
}