You are here

protected function S3fsStreamWrapper::_get_metadata_from_s3 in S3 File System 7.3

Same name and namespace in other branches
  1. 7 S3fsStreamWrapper.inc \S3fsStreamWrapper::_get_metadata_from_s3()
  2. 7.2 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|bool 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 1201
Drupal stream wrapper implementation for S3 File System.

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function _get_metadata_from_s3($uri) {
  $params = $this
    ->getCommandParams($uri);
  try {
    $result = $this->s3
      ->headObject($params);
  } catch (S3Exception $e) {

    // headObject() throws this exception if the requested key doesn't exist
    // in the bucket.
    watchdog_exception('S3FS', $e);
    return FALSE;
  }
  return _s3fs_convert_metadata($uri, $result);
}