public function S3fsStream::waitUntilFileExists in S3 File System 8.3
Same name and namespace in other branches
- 8.2 src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::waitUntilFileExists()
- 4.0.x src/StreamWrapper/S3fsStream.php \Drupal\s3fs\StreamWrapper\S3fsStream::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 S3fsStream::waitUntilFileExists()
- S3fsStream::writeUriToCache in src/
StreamWrapper/ S3fsStream.php - Write the file at the given URI into the metadata cache.
File
- src/
StreamWrapper/ S3fsStream.php, line 1150
Class
- S3fsStream
- Defines a Drupal s3 (s3://) stream wrapper class.
Namespace
Drupal\s3fs\StreamWrapperCode
public function waitUntilFileExists($uri) {
// Retry ten times, once every second.
$params = $this
->getCommandParams($uri);
$params['@waiter'] = [
'delay' => 1,
'maxAttempts' => 10,
];
try {
$this->s3
->waitUntil('ObjectExists', $params);
return TRUE;
} catch (S3fsException $e) {
watchdog_exception('S3FS', $e);
return FALSE;
} catch (\Exception $e) {
watchdog_exception('S3FS', $e);
return FALSE;
}
}