You are here

public function S3fsStream::stream_open in S3 File System 8.3

Same name and namespace in other branches
  1. 8.2 src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::stream_open()
  2. 4.0.x src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::stream_open()

Return value

bool

Overrides PhpStreamWrapperInterface::stream_open

File

src/StreamWrapper/S3fsStream.php, line 680

Class

S3fsStream
Defines a Drupal s3 (s3://) stream wrapper class.

Namespace

Drupal\s3fs\StreamWrapper

Code

public function stream_open($uri, $mode, $options, &$opened_path) {

  // phpcs:enable
  if (mb_strlen($uri) > S3fsServiceInterface::MAX_URI_LENGTH) {
    return FALSE;
  }
  $this
    ->setUri($uri);
  $converted = $this
    ->convertUriToKeyedPath($uri);
  $s3options = $this
    ->getOptions();

  // Allow other modules to alter the stream open params.
  \Drupal::moduleHandler()
    ->alter('s3fs_stream_open_params', $s3options[$this->protocol], $converted);
  stream_context_set_option($this->context, $s3options);
  return parent::stream_open($converted, $mode, $options, $opened_path);
}