protected function S3fsStreamWrapper::_get_metadata_from_s3 in S3 File System 7.2
Same name and namespace in other branches
- 7.3 S3fsStreamWrapper.inc \S3fsStreamWrapper::_get_metadata_from_s3()
- 7 S3fsStreamWrapper.inc \S3fsStreamWrapper::_get_metadata_from_s3()
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.
Throws
\Exception Any exception raised by the listObjects() S3 command will percolate out of this function.
2 calls to S3fsStreamWrapper::_get_metadata_from_s3()
- S3fsStreamWrapper::writeUriToCache in ./
S3fsStreamWrapper.inc - Write the file at the given URI into the metadata cache.
- S3fsStreamWrapper::_s3fs_get_object in ./
S3fsStreamWrapper.inc - Try to fetch an object from the metadata cache.
File
- ./
S3fsStreamWrapper.inc, line 1504 - Drupal stream wrapper implementation for S3 File System.
Class
- S3fsStreamWrapper
- The stream wrapper class.
Code
protected function _get_metadata_from_s3($uri) {
$this
->_debug("_get_metadata_from_s3({$uri}) called.", TRUE);
$params = $this
->_get_params($uri);
try {
$result = $this->s3
->headObject($params);
} catch (Aws\S3\Exception\NoSuchKeyException $e) {
// headObject() throws this exception if the requested key doesn't exist
// in the bucket.
return FALSE;
}
return _s3fs_convert_metadata($uri, $result);
}