summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/DAV.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-01-03 17:26:44 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-01-06 15:33:32 +0100
commit5774d3e82c093166e21ebb1d469e85acd240dab8 (patch)
tree909001d4ad898f1c4ccab05333f4dd52e8d71b37 /lib/private/Files/Storage/DAV.php
parent3ab22c2df53c8b86cbd72037ab407327b18cce11 (diff)
downloadnextcloud-server-5774d3e82c093166e21ebb1d469e85acd240dab8.tar.gz
nextcloud-server-5774d3e82c093166e21ebb1d469e85acd240dab8.zip
replace close:// streamwrapper with CallBackWrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Storage/DAV.php')
-rw-r--r--lib/private/Files/Storage/DAV.php18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index ea4bbba2748..62906f9355b 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -36,6 +36,7 @@ namespace OC\Files\Storage;
use Exception;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Message\ResponseInterface;
+use Icewind\Streams\CallbackWrapper;
use OC\Files\Filesystem;
use OC\Files\Stream\Close;
use Icewind\Streams\IteratorDirectory;
@@ -77,8 +78,6 @@ class DAV extends Common {
private $client;
/** @var ArrayCache */
private $statCache;
- /** @var array */
- private static $tempFiles = [];
/** @var \OCP\Http\Client\IClientService */
private $httpClientService;
@@ -409,20 +408,19 @@ class DAV extends Common {
}
$tmpFile = $tempManager->getTemporaryFile($ext);
}
- Close::registerCallback($tmpFile, array($this, 'writeBack'));
- self::$tempFiles[$tmpFile] = $path;
- return fopen('close://' . $tmpFile, $mode);
+ $handle = fopen($tmpFile, $mode);
+ return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
+ $this->writeBack($tmpFile, $path);
+ });
}
}
/**
* @param string $tmpFile
*/
- public function writeBack($tmpFile) {
- if (isset(self::$tempFiles[$tmpFile])) {
- $this->uploadFile($tmpFile, self::$tempFiles[$tmpFile]);
- unlink($tmpFile);
- }
+ public function writeBack($tmpFile, $path) {
+ $this->uploadFile($tmpFile, $path);
+ unlink($tmpFile);
}
/** {@inheritdoc} */