You are here

protected function S3fsStreamWrapper::_get_params in S3 File System 7.2

Same name and namespace in other branches
  1. 7 S3fsStreamWrapper.inc \S3fsStreamWrapper::_get_params()

Get the Command parameters for the specified URI.

Parameters

string $uri: The URI of the file.

Return value

array A Command parameters array, including 'Bucket', 'Key', and context parameters.

6 calls to S3fsStreamWrapper::_get_params()
S3fsStreamWrapper::rename in ./S3fsStreamWrapper.inc
Support for rename().
S3fsStreamWrapper::rmdir in ./S3fsStreamWrapper.inc
Support for rmdir().
S3fsStreamWrapper::stream_open in ./S3fsStreamWrapper.inc
Support for fopen(), file_get_contents(), file_put_contents() etc.
S3fsStreamWrapper::unlink in ./S3fsStreamWrapper.inc
Support for unlink().
S3fsStreamWrapper::waitUntilFileExists in ./S3fsStreamWrapper.inc
Wait for the specified file to exist in the bucket.

... See full list

File

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

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function _get_params($uri) {
  $params = $this
    ->_get_options();
  unset($params['seekable']);
  unset($params['throw_exceptions']);
  $params['Bucket'] = $this->config['bucket'];
  $params['Key'] = file_uri_target($uri);

  // public:// file are all placed in the s3fs_public_folder.
  $public_folder = !empty($this->config['public_folder']) ? $this->config['public_folder'] : 's3fs-public';
  $private_folder = !empty($this->config['private_folder']) ? $this->config['private_folder'] : 's3fs-private';
  if (file_uri_scheme($uri) == 'public') {
    $params['Key'] = "{$public_folder}/{$params['Key']}";
  }
  elseif (file_uri_scheme($uri) == 'private') {
    $params['Key'] = "{$private_folder}/{$params['Key']}";
  }

  // If it's set, all files are placed in the root folder.
  if (!empty($this->config['root_folder'])) {
    $params['Key'] = "{$this->config['root_folder']}/{$params['Key']}";
  }
  return $params;
}