You are here

public function S3fsStreamWrapper::waitUntilFileExists in S3 File System 7.3

Same name and namespace in other branches
  1. 7 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.

1 call to S3fsStreamWrapper::waitUntilFileExists()
S3fsStreamWrapper::writeUriToCache in ./S3fsStreamWrapper.inc
Write the file at the given uri into the metadata cache.

File

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

Class

S3fsStreamWrapper
The stream wrapper class.

Code

public function waitUntilFileExists($uri) {

  // Retry ten times, once every second.
  $params = $this
    ->getCommandParams($uri);
  $params['@waiter'] = array(
    'delay' => 1,
    'maxAttempts' => 10,
  );
  try {
    $this->s3
      ->waitUntil('ObjectExists', $params);
    return TRUE;
  } catch (S3Exception $e) {
    watchdog_exception('S3FS', $e);
    return FALSE;
  }
}