protected function S3fsStreamWrapper::_s3fs_get_object in S3 File System 7
Same name and namespace in other branches
- 7.3 S3fsStreamWrapper.inc \S3fsStreamWrapper::_s3fs_get_object()
- 7.2 S3fsStreamWrapper.inc \S3fsStreamWrapper::_s3fs_get_object()
Try to fetch an object from the metadata cache.
If that file isn't in the cache, we assume it doesn't exist.
Parameters
string $uri: A string containing the uri of the resource to check.
Return value
bool An array if the $uri exists, otherwise FALSE.
2 calls to S3fsStreamWrapper::_s3fs_get_object()
- S3fsStreamWrapper::getExternalUrl in ./
S3fsStreamWrapper.inc - Returns a web accessible URL for the resource.
- S3fsStreamWrapper::_stat in ./
S3fsStreamWrapper.inc - Get the status of the file with the specified URI.
File
- ./
S3fsStreamWrapper.inc, line 1156 - Drupal stream wrapper implementation for S3 File System.
Class
- S3fsStreamWrapper
- The stream wrapper class.
Code
protected function _s3fs_get_object($uri) {
$this
->_debug("_s3fs_get_object({$uri}) called.", TRUE);
// For the root directory, just return metadata for a generic folder.
if ($uri == 's3://' || $uri == 's3:') {
return _s3fs_convert_metadata('/', array());
}
// Trim any trailing '/', in case this is a folder request.
$uri = rtrim($uri, '/');
// Check if this URI is in the cache.
$metadata = $this
->_read_cache($uri);
// If cache ignore is enabled, query S3 for all URIs which aren't in the
// cache, and non-folder URIs which are.
if (!empty($this->config['ignore_cache']) && !$metadata['dir']) {
try {
// If _get_metadata_from_s3() returns FALSE, the file doesn't exist.
$metadata = $this
->_get_metadata_from_s3($uri);
} catch (\Exception $e) {
$this
->_debug($e
->getMessage());
return $this
->_trigger_error($e
->getMessage());
}
}
return $metadata;
}