Adjust for wide locking
This commit is contained in:
parent
21d02673be
commit
ddc8749814
|
@ -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);
|
||||
|
|
|
@ -62,7 +62,7 @@ class LockPlugin extends ServerPlugin {
|
|||
public function getLock(RequestInterface $request) {
|
||||
// we cant listen on 'beforeMethod:PUT' due to order of operations with setting up the tree
|
||||
// so instead we limit ourselves to the PUT method manually
|
||||
if ($request->getMethod() !== 'PUT') {
|
||||
if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
@ -80,7 +80,7 @@ class LockPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
public function releaseLock(RequestInterface $request) {
|
||||
if ($request->getMethod() !== 'PUT') {
|
||||
if ($request->getMethod() !== 'PUT' || isset($_SERVER['HTTP_OC_CHUNKED'])) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue