diff options
Diffstat (limited to 'lib/private/connector/sabre/objecttree.php')
-rw-r--r-- | lib/private/connector/sabre/objecttree.php | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php index 35cc1679ab6..a3de2efaa50 100644 --- a/lib/private/connector/sabre/objecttree.php +++ b/lib/private/connector/sabre/objecttree.php @@ -11,7 +11,7 @@ namespace OC\Connector\Sabre; use OC\Files\FileInfo; use OC\Files\Filesystem; -class ObjectTree extends \Sabre_DAV_ObjectTree { +class ObjectTree extends \Sabre\DAV\ObjectTree { /** * @var \OC\Files\View @@ -27,10 +27,10 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { } /** - * @param \Sabre_DAV_ICollection $rootNode + * @param \Sabre\DAV\ICollection $rootNode * @param \OC\Files\View $view */ - public function init(\Sabre_DAV_ICollection $rootNode, \OC\Files\View $view) { + public function init(\Sabre\DAV\ICollection $rootNode, \OC\Files\View $view) { $this->rootNode = $rootNode; $this->fileView = $view; } @@ -39,13 +39,13 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { * Returns the INode object for the requested path * * @param string $path - * @throws \Sabre_DAV_Exception_ServiceUnavailable - * @throws \Sabre_DAV_Exception_NotFound - * @return \Sabre_DAV_INode + * @throws \Sabre\DAV\Exception\ServiceUnavailable + * @throws \Sabre\DAV\Exception\NotFound + * @return \Sabre\DAV\INode */ public function getNodeForPath($path) { if (!$this->fileView) { - throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup'); + throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } $path = trim($path, '/'); @@ -79,7 +79,7 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { } if (!$info) { - throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located'); + throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); } if ($info->getType() === 'dir') { @@ -98,22 +98,22 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { * * @param string $sourcePath The path to the file which should be moved * @param string $destinationPath The full destination path, so not just the destination parent node - * @throws \Sabre_DAV_Exception_BadRequest - * @throws \Sabre_DAV_Exception_ServiceUnavailable - * @throws \Sabre_DAV_Exception_Forbidden + * @throws \Sabre\DAV\Exception\BadRequest + * @throws \Sabre\DAV\Exception\ServiceUnavailable + * @throws \Sabre\DAV\Exception\Forbidden * @return int */ public function move($sourcePath, $destinationPath) { if (!$this->fileView) { - throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup'); + throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } $sourceNode = $this->getNodeForPath($sourcePath); - if ($sourceNode instanceof \Sabre_DAV_ICollection and $this->nodeExists($destinationPath)) { - throw new \Sabre_DAV_Exception_Forbidden('Could not copy directory ' . $sourceNode . ', target exists'); + if ($sourceNode instanceof \Sabre\DAV\ICollection and $this->nodeExists($destinationPath)) { + throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode . ', target exists'); } - list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath); - list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath); + list($sourceDir,) = \Sabre\DAV\URLUtil::splitPath($sourcePath); + list($destinationDir,) = \Sabre\DAV\URLUtil::splitPath($destinationPath); $isShareMountPoint = false; list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath); @@ -123,38 +123,39 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { // check update privileges if (!$this->fileView->isUpdatable($sourcePath) && !$isShareMountPoint) { - throw new \Sabre_DAV_Exception_Forbidden(); + throw new \Sabre\DAV\Exception\Forbidden(); } if ($sourceDir !== $destinationDir) { // for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir if (ltrim($destinationDir, '/') === '') { - throw new \Sabre_DAV_Exception_Forbidden(); + throw new \Sabre\DAV\Exception\Forbidden(); } if (!$this->fileView->isUpdatable($sourceDir)) { - throw new \Sabre_DAV_Exception_Forbidden(); + throw new \Sabre\DAV\Exception\Forbidden(); } if (!$this->fileView->isUpdatable($destinationDir)) { - throw new \Sabre_DAV_Exception_Forbidden(); + throw new \Sabre\DAV\Exception\Forbidden(); } if (!$this->fileView->isDeletable($sourcePath)) { - throw new \Sabre_DAV_Exception_Forbidden(); + throw new \Sabre\DAV\Exception\Forbidden(); } } $fileName = basename($destinationPath); if (!\OCP\Util::isValidFileName($fileName)) { - throw new \Sabre_DAV_Exception_BadRequest(); + throw new \Sabre\DAV\Exception\BadRequest(); } $renameOkay = $this->fileView->rename($sourcePath, $destinationPath); if (!$renameOkay) { - throw new \Sabre_DAV_Exception_Forbidden(''); + throw new \Sabre\DAV\Exception\Forbidden(''); } // update properties $query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?' . ' WHERE `userid` = ? AND `propertypath` = ?'); - $query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), \OC\Files\Filesystem::normalizePath($sourcePath))); + $query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), + \OC\Files\Filesystem::normalizePath($sourcePath))); $this->markDirty($sourceDir); $this->markDirty($destinationDir); @@ -169,12 +170,12 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { * * @param string $source * @param string $destination - * @throws \Sabre_DAV_Exception_ServiceUnavailable + * @throws \Sabre\DAV\Exception\ServiceUnavailable * @return void */ public function copy($source, $destination) { if (!$this->fileView) { - throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup'); + throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } if ($this->fileView->is_file($source)) { @@ -192,7 +193,7 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { } } - list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destination); + list($destinationDir,) = \Sabre\DAV\URLUtil::splitPath($destination); $this->markDirty($destinationDir); } } |