use storage copy implementation when doing dav copy
instead of using the sabredav fallback (which does a read+write stream copy) this greatly speeds up dav copies Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
b9011c1d1d
commit
6790369cfe
|
@ -51,7 +51,7 @@ use Sabre\DAV\Exception\ServiceUnavailable;
|
||||||
use Sabre\DAV\IFile;
|
use Sabre\DAV\IFile;
|
||||||
use Sabre\DAV\INode;
|
use Sabre\DAV\INode;
|
||||||
|
|
||||||
class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget {
|
class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached directory content
|
* Cached directory content
|
||||||
|
@ -394,7 +394,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
|
||||||
throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
|
throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
list($sourceDir,) = \Sabre\Uri\split($sourceNode->getPath());
|
[$sourceDir,] = \Sabre\Uri\split($sourceNode->getPath());
|
||||||
$destinationDir = $this->getPath();
|
$destinationDir = $this->getPath();
|
||||||
|
|
||||||
$sourcePath = $sourceNode->getPath();
|
$sourcePath = $sourceNode->getPath();
|
||||||
|
@ -449,4 +449,26 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function copyInto($targetName, $sourcePath, INode $sourceNode) {
|
||||||
|
if ($sourceNode instanceof File) {
|
||||||
|
$destinationPath = $this->getPath() . '/' . $targetName;
|
||||||
|
$sourcePath = $sourceNode->getPath();
|
||||||
|
|
||||||
|
if (!$this->fileView->isCreatable($this->getPath())) {
|
||||||
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->fileView->verifyPath($this->getPath(), $targetName);
|
||||||
|
} catch (InvalidPathException $ex) {
|
||||||
|
throw new InvalidPath($ex->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->fileView->copy($sourcePath, $destinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue