function awssdk_config_defaults in AWS SDK for PHP 7.4
Same name and namespace in other branches
- 7.3 awssdk.module \awssdk_config_defaults()
Load the default AWSSDK settings.
Return value
An associative array containing default settings, or FALSE.
3 calls to awssdk_config_defaults()
- AWSSDKUIUnitTest::testUI in ui/
awssdk_ui.test - Ensure the UI settings match those provided by the SDK.
- AWSSDKUnitTest::testLibrary in ./
awssdk.test - Ensure that AWS SDK libraries integration and configuration work properly.
- awssdk_config_load in ./
awssdk.module - Load the default AWSSDK settings and apply variable overrides.
File
- ./
awssdk.module, line 111 - Provides primary Drupal hook implementations.
Code
function awssdk_config_defaults() {
// Attempt to load the sample configuration file provided with AWSSDK.
if (file_exists($sample_config = libraries_get_path('awssdk') . '/config-sample.inc.php')) {
// Use a regular expression to determine the default values for the
// configuration constants instead of including the file so that the
// constants are never defined in the current process to prevent possible
// conflicts that might occur if caches are cleared when the AWSSDK is
// attempting to be used.
$contents = file_get_contents($sample_config);
if (preg_match_all("/define\\('(\\w+)', (.*)\\);/", $contents, $matches, PREG_SET_ORDER)) {
$defaults = array();
foreach ($matches as $match) {
$defaults[strtolower($match[1])] = eval('return ' . $match[2] . ';');
}
return $defaults;
}
}
return FALSE;
}