summaryrefslogtreecommitdiffstats
path: root/lib/private/connector/sabre/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/connector/sabre/file.php')
-rw-r--r--lib/private/connector/sabre/file.php84
1 files changed, 13 insertions, 71 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 9b529d2e0f1..0355376c46b 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -1,38 +1,7 @@
<?php
-/**
- * @author Andreas Fischer <bantu@owncloud.com>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Bjoern Schiessle <schiessle@owncloud.com>
- * @author chli1 <chli1@users.noreply.github.com>
- * @author Chris Wilson <chris+github@qwirx.com>
- * @author Jakob Sack <mail@jakobsack.de>
- * @author Joas Schilling <nickvergessen@gmx.de>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Owen Winkler <a_github@midnightcircus.com>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- * @author Vincent Petry <pvince81@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * 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 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.
- *
- * 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/>
- *
- */
-class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\DAV\IFile {
+namespace OC\Connector\Sabre;
+
+class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile {
/**
* Updates the data
@@ -52,11 +21,12 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
* return an ETag, and just return null.
*
* @param resource $data
+ *
* @throws \Sabre\DAV\Exception\Forbidden
- * @throws OC_Connector_Sabre_Exception_UnsupportedMediaType
+ * @throws \OC\Connector\Sabre\Exception\UnsupportedMediaType
* @throws \Sabre\DAV\Exception\BadRequest
* @throws \Sabre\DAV\Exception
- * @throws OC_Connector_Sabre_Exception_EntityTooLarge
+ * @throws \OC\Connector\Sabre\Exception\EntityTooLarge
* @throws \Sabre\DAV\Exception\ServiceUnavailable
* @return string|null
*/
@@ -110,11 +80,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
} catch (\OCP\Files\EntityTooLargeException $e) {
// the file is too big to be stored
- throw new OC_Connector_Sabre_Exception_EntityTooLarge($e->getMessage());
+ throw new \OC\Connector\Sabre\Exception\EntityTooLarge($e->getMessage());
} catch (\OCP\Files\InvalidContentException $e) {
// the file content is not permitted
- throw new OC_Connector_Sabre_Exception_UnsupportedMediaType($e->getMessage());
+ throw new \OC\Connector\Sabre\Exception\UnsupportedMediaType($e->getMessage());
} catch (\OCP\Files\InvalidPathException $e) {
// the path for the file was not valid
@@ -122,7 +92,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
} catch (\OCP\Files\LockNotAcquiredException $e) {
// the file is currently being written to by another process
- throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
+ throw new \OC\Connector\Sabre\Exception\FileLocked($e->getMessage(), $e->getCode(), $e);
} catch (\OCA\Files_Encryption\Exception\EncryptionException $e) {
throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
} catch (\OCP\Files\StorageNotAvailableException $e) {
@@ -155,7 +125,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
}
catch (\OCP\Files\LockNotAcquiredException $e) {
// the file is currently being written to by another process
- throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
+ throw new \OC\Connector\Sabre\Exception\FileLocked($e->getMessage(), $e->getCode(), $e);
}
}
@@ -215,34 +185,6 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
} catch (\OCP\Files\StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to unlink: ".$e->getMessage());
}
-
- // remove properties
- $this->removeProperties();
-
- }
-
- /**
- * Returns the size of the node, in bytes
- *
- * @return int|float
- */
- public function getSize() {
- return $this->info->getSize();
- }
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the
- * file. If the file changes, the ETag MUST change. The ETag is an
- * arbitrary string, but MUST be surrounded by double-quotes.
- *
- * Return null if the ETag can not effectively be determined
- *
- * @return mixed
- */
- public function getETag() {
- return '"' . $this->info->getEtag() . '"';
}
/**
@@ -288,13 +230,13 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
*/
private function createFileChunked($data)
{
- list($path, $name) = \Sabre\DAV\URLUtil::splitPath($this->path);
+ list($path, $name) = \Sabre\HTTP\URLUtil::splitPath($this->path);
- $info = OC_FileChunking::decodeName($name);
+ $info = \OC_FileChunking::decodeName($name);
if (empty($info)) {
throw new \Sabre\DAV\Exception\NotImplemented();
}
- $chunk_handler = new OC_FileChunking($info);
+ $chunk_handler = new \OC_FileChunking($info);
$bytesWritten = $chunk_handler->store($info['index'], $data);
//detect aborted upload