You are here

protected function S3fsStream::_open_append_stream in S3 File System 8.2

Initialize the stream wrapper for an append stream.

Parameters

array $params: An array of AWS SDK for PHP Command parameters.

array $errors: OUT parameter: all encountered errors are appended to this array.

1 call to S3fsStream::_open_append_stream()
S3fsStream::stream_open in src/StreamWrapper/S3fsStream.php
Support for fopen(), file_get_contents(), file_put_contents() etc.

File

src/StreamWrapper/S3fsStream.php, line 1447

Class

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

Namespace

Drupal\s3fs\StreamWrapper

Code

protected function _open_append_stream($params, &$errors) {
  $this
    ->_debug("_open_append_stream({$params['Key']}) called.", TRUE);
  try {

    // Get the body of the object
    $this->body = $this->s3
      ->getObject($params)
      ->get('Body');
    $this->body
      ->seek(0, SEEK_END);
  } catch (Aws\S3\Exception\S3Exception $e) {

    // The object does not exist, so use a simple write stream.
    $this
      ->_open_write_stream($params, $errors);
  }
}