You are here

public function S3fsStreamWrapper::waitUntilFileExists in S3 File System 7

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

Wait for the specified file to exist in the bucket.

Parameters

string $uri: The URI of the file.

Return value

bool Returns TRUE once the waiting finishes, or FALSE if the file does not begin to exist within 10 seconds.

File

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

Class

S3fsStreamWrapper
The stream wrapper class.

Code

public function waitUntilFileExists($uri) {
  $wait_params = $this
    ->_get_params($uri);

  // Retry ten times, once every second.
  $wait_params['waiter.max_attempts'] = 10;
  $wait_params['waiter.interval'] = 1;
  try {
    $this->s3
      ->waitUntilObjectExists($wait_params);
  } catch (Aws\Common\Exception\RuntimeException $e) {
    return FALSE;
  }
  return TRUE;
}