You are here

class PrivateS3fsStream in S3 File System 8.3

Same name and namespace in other branches
  1. 8.2 src/StreamWrapper/PrivateS3fsStream.php \Drupal\s3fs\StreamWrapper\PrivateS3fsStream
  2. 4.0.x src/StreamWrapper/PrivateS3fsStream.php \Drupal\s3fs\StreamWrapper\PrivateS3fsStream

Defines a Drupal s3fs stream wrapper class for use with private scheme.

Provides support for storing files on the amazon s3 file system with the Drupal file interface.

Hierarchy

Expanded class hierarchy of PrivateS3fsStream

File

src/StreamWrapper/PrivateS3fsStream.php, line 13

Namespace

Drupal\s3fs\StreamWrapper
View source
class PrivateS3fsStream extends S3fsStream {

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this
      ->t('Private files (s3fs)');
  }

  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return $this
      ->t('Private files served from Amazon S3.');
  }

  /**
   * {@inheritdoc}
   */
  public function getExternalUrl() {
    $s3_key = str_replace('\\', '/', $this->streamWrapperManager::getTarget($this->uri));
    return Url::fromRoute('system.private_file_download', [
      'filepath' => $s3_key,
    ], [
      'absolute' => TRUE,
      'path_processing' => FALSE,
    ])
      ->toString();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PhpStreamWrapperInterface::dir_closedir public function 1
PhpStreamWrapperInterface::dir_rewinddir public function 1
PhpStreamWrapperInterface::stream_cast public function Retrieve the underlying stream resource. 1
PhpStreamWrapperInterface::stream_close public function Closes stream. 1
PhpStreamWrapperInterface::stream_eof public function 1
PhpStreamWrapperInterface::stream_read public function 1
PhpStreamWrapperInterface::stream_seek public function Seeks to specific location in a stream. 1
PhpStreamWrapperInterface::stream_stat public function 1
PhpStreamWrapperInterface::stream_tell public function 1
PhpStreamWrapperInterface::stream_write public function 2
PrivateS3fsStream::getDescription public function Returns the description of the stream wrapper for use in the UI. Overrides S3fsStream::getDescription
PrivateS3fsStream::getExternalUrl public function Returns a web accessible URL for the resource. Overrides S3fsStream::getExternalUrl
PrivateS3fsStream::getName public function Returns the name of the stream wrapper for use in the UI. Overrides S3fsStream::getName
S3fsStream::$cname protected property Custom domain used to access files.
S3fsStream::$config protected property Module configuration for stream.
S3fsStream::$dir protected property Directory listing used by the dir_* methods.
S3fsStream::$errorState protected property Indicates the current error state in the wrapper.
S3fsStream::$mimeTypeMapping protected static property Default map for determining file mime types.
S3fsStream::$mode private property Mode in which the stream was opened.
S3fsStream::$params private property Hash of opened stream parameters.
S3fsStream::$presignedURLs protected property Files which should be created with URLs that eventually time out.
S3fsStream::$protocol private property The opened protocol (e.g., "s3").
S3fsStream::$s3 protected property The AWS SDK for PHP S3Client object.
S3fsStream::$s3fs protected property The S3fs Service.
S3fsStream::$saveas protected property Files that the user has said must be downloaded, rather than viewed.
S3fsStream::$streamWrapperManager protected property The stream wrapper manager.
S3fsStream::$torrents protected property Map for files that should be delivered with a torrent URL.
S3fsStream::$uploadAsPrivate protected property All files included public files will be private if this feature is enable.
S3fsStream::$uri protected property Instance uri referenced as "<scheme>://key".
S3fsStream::API_VERSION constant
S3fsStream::appendGetArg protected static function Helper function to safely append a GET argument to a given base URL.
S3fsStream::convertUriToKeyedPath protected function Converts a Drupal URI path into what is expected to be stored in S3.
S3fsStream::deleteCache protected function Delete an object's metadata from the cache.
S3fsStream::dirname public function Gets the name of the parent directory of a given path. Overrides StreamWrapperInterface::dirname
S3fsStream::dir_opendir public function Overrides PhpStreamWrapperInterface::dir_opendir
S3fsStream::dir_readdir public function Overrides PhpStreamWrapperInterface::dir_readdir
S3fsStream::getClient private function
S3fsStream::getCommandParams protected function Return bucket and key for a command array.
S3fsStream::getDirectoryPath public function Gets the path that the wrapper is responsible for.
S3fsStream::getOptions private function Get the stream's context options or remove them if wanting default.
S3fsStream::getS3fsObject protected function Try to fetch an object from the metadata cache.
S3fsStream::getS3Metadata protected function Returns the converted metadata for an object in S3.
S3fsStream::getType public static function Returns the type of stream wrapper. Overrides StreamWrapperInterface::getType
S3fsStream::getUri public function Returns the stream resource URI, which looks like "<scheme>://filepath". Overrides StreamWrapperInterface::getUri
S3fsStream::isDir protected function Determine whether the $uri is a directory.
S3fsStream::mkdir public function Support for mkdir(). Overrides PhpStreamWrapperInterface::mkdir
S3fsStream::readCache protected function Fetch an object from the file metadata cache table.
S3fsStream::realpath public function This wrapper does not support realpath(). Overrides StreamWrapperInterface::realpath
S3fsStream::register public static function
S3fsStream::rename public function Support for rename(). Overrides PhpStreamWrapperInterface::rename
S3fsStream::rmdir public function Support for rmdir(). Overrides PhpStreamWrapperInterface::rmdir
S3fsStream::setUri public function Sets the stream resource URI. URIs are formatted as "<scheme>://filepath". Overrides StreamWrapperInterface::setUri
S3fsStream::stat protected function Get the status of the file with the specified URI.
S3fsStream::stream_flush public function Overrides PhpStreamWrapperInterface::stream_flush
S3fsStream::stream_lock public function Overrides PhpStreamWrapperInterface::stream_lock
S3fsStream::stream_metadata public function Sets metadata on the stream. Overrides PhpStreamWrapperInterface::stream_metadata
S3fsStream::stream_open public function Overrides PhpStreamWrapperInterface::stream_open
S3fsStream::stream_set_option public function Change stream options. Overrides PhpStreamWrapperInterface::stream_set_option
S3fsStream::stream_truncate public function Truncate stream. Overrides PhpStreamWrapperInterface::stream_truncate
S3fsStream::triggerError protected function Triggers one or more errors.
S3fsStream::unlink public function Support for unlink(). Overrides PhpStreamWrapperInterface::unlink
S3fsStream::url_stat public function Overrides PhpStreamWrapperInterface::url_stat
S3fsStream::waitUntilFileExists public function Wait for the specified file to exist in the bucket.
S3fsStream::writeCache protected function Write an object's (and its ancestor folders') metadata to the cache.
S3fsStream::writeUriToCache public function Write the file at the given URI into the metadata cache.
S3fsStream::__construct public function S3fsStream constructor.
StreamWrapperInterface::ALL constant A filter that matches all wrappers.
StreamWrapperInterface::HIDDEN constant Defines the stream wrapper bit flag for a hidden file.
StreamWrapperInterface::LOCAL constant Refers to a local file system location.
StreamWrapperInterface::LOCAL_HIDDEN constant Hidden, readable and writable using local files.
StreamWrapperInterface::LOCAL_NORMAL constant Visible, readable and writable using local files.
StreamWrapperInterface::NORMAL constant This is the default 'type' flag. This does not include StreamWrapperInterface::LOCAL, because PHP grants a greater trust level to local files (for example, they can be used in an "include" statement, regardless of the…
StreamWrapperInterface::READ constant Wrapper is readable (almost always true).
StreamWrapperInterface::READ_VISIBLE constant Visible and read-only.
StreamWrapperInterface::VISIBLE constant Exposed in the UI and potentially web accessible.
StreamWrapperInterface::WRITE constant Wrapper is writable.
StreamWrapperInterface::WRITE_VISIBLE constant Visible, readable and writable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.