function __flysystem_validate_schemes in Flysystem 8
Same name and namespace in other branches
- 3.x flysystem.install \__flysystem_validate_schemes()
- 2.0.x flysystem.install \__flysystem_validate_schemes()
- 3.0.x flysystem.install \__flysystem_validate_schemes()
Validates configured schemes.
1 call to __flysystem_validate_schemes()
- flysystem_requirements in ./
flysystem.install - Implements hook_requirements().
File
- ./
flysystem.install, line 37 - Install, update and uninstall functions for the flysystem module.
Code
function __flysystem_validate_schemes(array &$requirements) {
$invalid = [];
foreach (array_keys(Settings::get('flysystem', [])) as $scheme) {
if (!preg_match('/^[a-zA-Z0-9+.-]+$/', $scheme)) {
$invalid[] = $scheme;
}
}
if ($invalid) {
$requirements['flysystem_invalid_scheme'] = [
'title' => \Drupal::translation()
->translate('Invalid Flysystem schemes in settings.php'),
'description' => \Drupal::translation()
->translate("The following schemes are not in the correct format: %schemes. Scheme names can only contain letters, numbers, + (plus sign), . (period), - (hyphen).", [
'%schemes' => implode(', ', $invalid),
]),
'severity' => REQUIREMENT_ERROR,
];
}
}