protected function S3fsStream::_s3fs_get_object in S3 File System 8.2
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: The uri of the resource to check.
Return value
bool An array if the $uri exists, otherwise FALSE.
3 calls to S3fsStream::_s3fs_get_object()
- S3fsStream::getExternalUrl in src/
StreamWrapper/ S3fsStream.php - Returns a web accessible URL for the resource.
- S3fsStream::_stat in src/
StreamWrapper/ S3fsStream.php - Get the status of the file with the specified URI.
- S3fsStream::_uri_is_dir in src/
StreamWrapper/ S3fsStream.php - Determine whether the $uri is a directory.
File
- src/
StreamWrapper/ S3fsStream.php, line 1212
Class
- S3fsStream
- Defines a Drupal s3fs (s3fs://) stream wrapper class.
Namespace
Drupal\s3fs\StreamWrapperCode
protected function _s3fs_get_object($uri) {
$this
->_debug("_s3fs_get_object({$uri}) called.", TRUE);
// For the root directory, return metadata for a generic folder.
if (file_uri_target($uri) == '') {
return $this
->convertMetadata('/', []);
}
// 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;
}