summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/connector/sabre/file.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-09-15 17:59:44 +0200
committerRobin Appelman <icewind@owncloud.com>2015-10-20 14:14:56 +0200
commitddc8749814a38b33881721a8f4eccfe15e13dacb (patch)
tree2f04b9e991ea8f820e2644dff96d3f096fd092e6 /apps/dav/lib/connector/sabre/file.php
parent21d02673becc2bc9f7312eae18c3150778a94364 (diff)
downloadnextcloud-server-ddc8749814a38b33881721a8f4eccfe15e13dacb.tar.gz
nextcloud-server-ddc8749814a38b33881721a8f4eccfe15e13dacb.zip
Adjust for wide locking
Diffstat (limited to 'apps/dav/lib/connector/sabre/file.php')
-rw-r--r--apps/dav/lib/connector/sabre/file.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php
index a0581de53ae..df9d98b9792 100644
--- a/apps/dav/lib/connector/sabre/file.php
+++ b/apps/dav/lib/connector/sabre/file.php
@@ -349,9 +349,14 @@ class File extends Node implements IFile {
if (empty($info)) {
throw new NotImplemented('Invalid chunk name');
}
+
+ $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE);
+
$chunk_handler = new \OC_FileChunking($info);
$bytesWritten = $chunk_handler->store($info['index'], $data);
+ $this->changeLock(ILockingProvider::LOCK_SHARED);
+
//detect aborted upload
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
if (isset($_SERVER['CONTENT_LENGTH'])) {
@@ -376,9 +381,10 @@ class File extends Node implements IFile {
$exists = $this->fileView->file_exists($targetPath);
try {
- $this->emitPreHooks($exists, $targetPath);
+ $this->fileView->lockFile($targetPath, ILockingProvider::LOCK_SHARED);
- $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE);
+ $this->emitPreHooks($exists, $targetPath);
+ $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_EXCLUSIVE);
/** @var \OC\Files\Storage\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
@@ -403,7 +409,7 @@ class File extends Node implements IFile {
$partFile = null;
$targetStorage->unlink($targetInternalPath);
}
- $this->changeLock(ILockingProvider::LOCK_SHARED);
+ $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_SHARED);
throw new Exception('Could not rename part file assembled from chunks');
}
} else {
@@ -419,7 +425,7 @@ class File extends Node implements IFile {
}
}
- $this->changeLock(ILockingProvider::LOCK_SHARED);
+ $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_SHARED);
// since we skipped the view we need to scan and emit the hooks ourselves
$this->fileView->getUpdater()->update($targetPath);