diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-02-18 18:28:24 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-09 10:38:37 +0100 |
commit | 49e1a81eba45fe33e00c217758656cf9201ec0cd (patch) | |
tree | 8bf628e52c0003b67677a6fad49adbd01941492d /lib | |
parent | 4bac595068c813c56d8d5e580e560527ba80194d (diff) | |
download | nextcloud-server-49e1a81eba45fe33e00c217758656cf9201ec0cd.tar.gz nextcloud-server-49e1a81eba45fe33e00c217758656cf9201ec0cd.zip |
fixing namespaces and PHPDoc
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/connector/sabre/exception/invalidpath.php | 16 | ||||
-rw-r--r-- | lib/private/connector/sabre/node.php | 40 | ||||
-rw-r--r-- | lib/private/connector/sabre/objecttree.php | 3 | ||||
-rw-r--r-- | lib/private/files/view.php | 5 |
4 files changed, 44 insertions, 20 deletions
diff --git a/lib/private/connector/sabre/exception/invalidpath.php b/lib/private/connector/sabre/exception/invalidpath.php index 18285994bcc..ecf28f377b0 100644 --- a/lib/private/connector/sabre/exception/invalidpath.php +++ b/lib/private/connector/sabre/exception/invalidpath.php @@ -1,12 +1,17 @@ <?php - /** * Copyright (c) 2015 Thomas Müller <deepdiver@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ -class OC_Connector_Sabre_Exception_InvalidPath extends \Sabre\DAV\Exception { +namespace OC\Connector\Sabre\Exception; + +use Sabre\DAV\Exception; + +class InvalidPath extends Exception { + + const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** * @var bool @@ -34,7 +39,8 @@ class OC_Connector_Sabre_Exception_InvalidPath extends \Sabre\DAV\Exception { } /** - * This method allows the exception to include additional information into the WebDAV error response + * This method allows the exception to include additional information + * into the WebDAV error response * * @param \Sabre\DAV\Server $server * @param \DOMElement $errorNode @@ -42,8 +48,8 @@ class OC_Connector_Sabre_Exception_InvalidPath extends \Sabre\DAV\Exception { */ public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { - // set owncloud namespace - $errorNode->setAttribute('xmlns:o', OC_Connector_Sabre_FilesPlugin::NS_OWNCLOUD); + // set ownCloud namespace + $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); // adding the retry node $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index 775e18657f1..cdabf26a3fb 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -1,28 +1,40 @@ <?php - /** - * ownCloud + * @author Arthur Schiwon <blizzz@owncloud.com> + * @author Bart Visscher <bartv@thisnet.nl> + * @author Björn Schießle <schiessle@owncloud.com> + * @author Jakob Sack <mail@jakobsack.de> + * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Klaas Freitag <freitag@owncloud.com> + * @author Markus Goetz <markus@woboq.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin Appelman <icewind@owncloud.com> + * @author Sam Tuke <mail@samtuke.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Vincent Petry <pvince81@owncloud.com> * - * @author Jakob Sack - * @copyright 2011 Jakob Sack kde@jakobsack.de + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. * - * This library is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OC\Connector\Sabre; +use OC\Connector\Sabre\Exception\InvalidPath; + + abstract class Node implements \Sabre\DAV\INode { /** * Allow configuring the method used to generate Etags @@ -235,7 +247,7 @@ abstract class Node implements \Sabre\DAV\INode { $fileName = basename($this->info->getPath()); $this->fileView->verifyPath($this->path, $fileName); } catch (\OCP\Files\InvalidPathException $ex) { - throw new OC_Connector_Sabre_Exception_InvalidPath($ex->getMessage()); + throw new InvalidPath($ex->getMessage()); } } } diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php index 04ca1d7104d..3705aa80586 100644 --- a/lib/private/connector/sabre/objecttree.php +++ b/lib/private/connector/sabre/objecttree.php @@ -8,6 +8,7 @@ namespace OC\Connector\Sabre; +use OC\Connector\Sabre\Exception\InvalidPath; use OC\Files\FileInfo; use OC\Files\Filesystem; use OC\Files\Mount\MoveableMount; @@ -189,7 +190,7 @@ class ObjectTree extends \Sabre\DAV\Tree { try { $this->fileView->verifyPath($destinationDir, $fileName); } catch (\OCP\Files\InvalidPathException $ex) { - throw new OC_Connector_Sabre_Exception_InvalidPath($ex->getMessage()); + throw new InvalidPath($ex->getMessage()); } $renameOkay = $this->fileView->rename($sourcePath, $destinationPath); diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 17fad72e5e7..6a93d7bbf8a 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -1536,6 +1536,11 @@ class View { return $this->updater; } + /** + * @param string $path + * @param string $fileName + * @throws InvalidPathException + */ public function verifyPath($path, $fileName) { // verify empty and dot files |