public function ActionsForm::credentialsCacheValidateForm in S3 File System 4.0.x
Same name and namespace in other branches
- 8.3 src/Form/ActionsForm.php \Drupal\s3fs\Form\ActionsForm::credentialsCacheValidateForm()
Refreshes in form validation.
Parameters
array $form: Array that contains the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ ActionsForm.php, line 339
Class
- ActionsForm
- Defines an actions form.
Namespace
Drupal\s3fs\FormCode
public function credentialsCacheValidateForm(array &$form, FormStateInterface $form_state) {
$config = \Drupal::config('s3fs.settings')
->get();
if (empty($config['credentials_cache_dir']) || !class_exists('\\Doctrine\\Common\\Cache\\FilesystemCache')) {
$form_state
->setError($form, $this
->t("Credentials cache not properly setup. Unable to delete."));
}
try {
@\Drupal::service('file_system')
->deleteRecursive($config['credentials_cache_dir'] . '/s3fscache');
} catch (FileException $e) {
$form_state
->setError($form, $this
->t("Unable to delete credential cache directory. @message", [
'@message' => $e,
]));
}
}