You are here

protected function S3fsStreamWrapper::_open_append_stream in S3 File System 7.2

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

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 S3fsStreamWrapper::_open_append_stream()
S3fsStreamWrapper::stream_open in ./S3fsStreamWrapper.inc
Support for fopen(), file_get_contents(), file_put_contents() etc.

File

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

Class

S3fsStreamWrapper
The stream wrapper class.

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);
  }
}