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

Commit

Permalink
Fixing "file_put_contents(): Exclusive locks are not supported for th…
Browse files Browse the repository at this point in the history
…is stream" exception in docker on nfs file systems
  • Loading branch information
Robert Kummer committed Jan 24, 2018
1 parent bf88ff0 commit 7ca28df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/Jobs/CreateRemoteFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ private function cacheRemoteFileLocally(RemoteFile $remoteFile, string $content)
}

$path = $remoteFile->getLocalStoragePath();
if ($filesystem->put($path, $content)) {

$fh = fopen('php://memory', 'r+');
fwrite($fh, $content);
rewind($fh);

if ($filesystem->put($path, $fh)) {
$remoteFile->path = $path;
$remoteFile->save();
}
Expand Down
7 changes: 6 additions & 1 deletion app/Jobs/UpdateRemoteFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ private function cacheRemoteFileLocally(RemoteFile $remoteFile, string $content)
}

$path = $remoteFile->getLocalStoragePath();
if ($this->getFilesystem()->put($path, $content)) {

$fh = fopen('php://memory', 'r+');
fwrite($fh, $content);
rewind($fh);

if ($this->getFilesystem()->put($path, $fh)) {
$remoteFile->path = $path;
$remoteFile->save();
}
Expand Down

0 comments on commit 7ca28df

Please sign in to comment.