Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Commit 7ca28df

Browse files
author
Robert Kummer
committed
Fixing "file_put_contents(): Exclusive locks are not supported for this stream" exception in docker on nfs file systems
1 parent bf88ff0 commit 7ca28df

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

app/Jobs/CreateRemoteFile.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ private function cacheRemoteFileLocally(RemoteFile $remoteFile, string $content)
113113
}
114114

115115
$path = $remoteFile->getLocalStoragePath();
116-
if ($filesystem->put($path, $content)) {
116+
117+
$fh = fopen('php://memory', 'r+');
118+
fwrite($fh, $content);
119+
rewind($fh);
120+
121+
if ($filesystem->put($path, $fh)) {
117122
$remoteFile->path = $path;
118123
$remoteFile->save();
119124
}

app/Jobs/UpdateRemoteFile.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ private function cacheRemoteFileLocally(RemoteFile $remoteFile, string $content)
125125
}
126126

127127
$path = $remoteFile->getLocalStoragePath();
128-
if ($this->getFilesystem()->put($path, $content)) {
128+
129+
$fh = fopen('php://memory', 'r+');
130+
fwrite($fh, $content);
131+
rewind($fh);
132+
133+
if ($this->getFilesystem()->put($path, $fh)) {
129134
$remoteFile->path = $path;
130135
$remoteFile->save();
131136
}

0 commit comments

Comments
 (0)