You are here

protected function S3fsStreamWrapper::_open_append_stream in S3 File System 7

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

Initialize the stream wrapper for an append stream.

Parameters

array $params: A Command parameters array.

array $errors: Array to which encountered errors should be appended.

Return value

bool

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 1348
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);
  }
  return true;
}