You are here

protected function S3fsStreamWrapper::_uri_is_dir in S3 File System 7

Same name and namespace in other branches
  1. 7.2 S3fsStreamWrapper.inc \S3fsStreamWrapper::_uri_is_dir()

Determine whether the $uri is a directory.

Parameters

string $uri: A string containing the uri to the resource to check. If none is given defaults to $this->uri

Return value

bool TRUE if the resource is a directory

2 calls to S3fsStreamWrapper::_uri_is_dir()
S3fsStreamWrapper::dir_opendir in ./S3fsStreamWrapper.inc
Support for opendir().
S3fsStreamWrapper::rmdir in ./S3fsStreamWrapper.inc
Support for rmdir().

File

./S3fsStreamWrapper.inc, line 1133
Drupal stream wrapper implementation for S3 File System.

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function _uri_is_dir($uri) {
  if ($uri == 's3://' || $uri == 's3:') {
    return TRUE;
  }

  // Folders only exist in the cache, so we don't need to query S3.
  // Since they're stored with no ending slash, so we need to trim it.
  $uri = rtrim($uri, '/');
  $metadata = $this
    ->_read_cache($uri);
  return $metadata ? $metadata['dir'] : FALSE;
}