public function S3::ensure in Flysystem - S3 8
Same name and namespace in other branches
- 2.0.x src/Flysystem/S3.php \Drupal\flysystem_s3\Flysystem\S3::ensure()
Checks the sanity of the filesystem.
If this is a local filesystem, .htaccess file should be in place.
Return value
array A list of error messages.
Overrides FlysystemPluginInterface::ensure
File
- src/
Flysystem/ S3.php, line 208
Class
- S3
- Drupal plugin for the "S3" Flysystem adapter.
Namespace
Drupal\flysystem_s3\FlysystemCode
public function ensure($force = FALSE) {
try {
$this
->getAdapter()
->listContents();
} catch (S3Exception $e) {
$message = $e
->getMessage();
\Drupal::logger('flysystem_s3')
->error($message);
}
// @TODO: If the bucket exists, can we write to it? Find a way to test that.
if (!$this->client
->doesBucketExist($this->bucket)) {
return [
[
'severity' => RfcLogLevel::ERROR,
'message' => 'Bucket %bucket does not exist.',
'context' => [
'%bucket' => $this->bucket,
],
],
];
}
return [];
}