protected function S3fsStream::getS3Metadata in S3 File System 8.3
Same name and namespace in other branches
- 4.0.x src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::getS3Metadata()
Returns the converted metadata for an object in S3.
Parameters
string $uri: The URI for the object in S3.
Return value
array An array of DB-compatible file metadata or empty array if lookup fails.
2 calls to S3fsStream::getS3Metadata()
- S3fsStream::getS3fsObject in src/
StreamWrapper/ S3fsStream.php - Try to fetch an object from the metadata cache.
- S3fsStream::writeUriToCache in src/
StreamWrapper/ S3fsStream.php - Write the file at the given URI into the metadata cache.
File
- src/
StreamWrapper/ S3fsStream.php, line 1416
Class
- S3fsStream
- Defines a Drupal s3 (s3://) stream wrapper class.
Namespace
Drupal\s3fs\StreamWrapperCode
protected function getS3Metadata($uri) {
$params = $this
->getCommandParams($uri);
try {
$result = $this->s3
->headObject($params);
$data = $result
->toArray();
} catch (S3Exception $e) {
// headObject() throws this exception if the requested key doesn't exist
// in the bucket.
return FALSE;
} catch (\Exception $e) {
watchdog_exception('S3FS', $e);
return FALSE;
}
return $this->s3fs
->convertMetadata($uri, $data);
}