summaryrefslogtreecommitdiffstats
path: root/lib/private/connector/sabre/objecttree.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-03-04 13:28:48 +0100
committerRobin Appelman <icewind@owncloud.com>2014-03-04 13:28:48 +0100
commit5ef37c28d1dc73c1fc16a731954b84b46c1943f4 (patch)
treea474078c1947e12293b4df26bb0d3068d5804a93 /lib/private/connector/sabre/objecttree.php
parent331fc55e2d876123580986264f47318afcf9352b (diff)
downloadnextcloud-server-5ef37c28d1dc73c1fc16a731954b84b46c1943f4.tar.gz
nextcloud-server-5ef37c28d1dc73c1fc16a731954b84b46c1943f4.zip
Remove the need for a custom SabreDav server constructor
Diffstat (limited to 'lib/private/connector/sabre/objecttree.php')
-rw-r--r--lib/private/connector/sabre/objecttree.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index d176d3333f8..76f4817d3ba 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -22,12 +22,16 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
* Creates the object
*
* This method expects the rootObject to be passed as a parameter
- *
+ */
+ public function __construct() {
+ }
+
+ /**
* @param \Sabre_DAV_ICollection $rootNode
* @param \OC\Files\View $view
*/
- public function __construct(\Sabre_DAV_ICollection $rootNode, $view) {
- parent::__construct($rootNode);
+ public function init(\Sabre_DAV_ICollection $rootNode, \OC\Files\View $view) {
+ $this->rootNode = $rootNode;
$this->fileView = $view;
}
@@ -39,6 +43,9 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
* @return \Sabre_DAV_INode
*/
public function getNodeForPath($path) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
$path = trim($path, '/');
if (isset($this->cache[$path])) {
@@ -94,6 +101,9 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
* @return int
*/
public function move($sourcePath, $destinationPath) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
$sourceNode = $this->getNodeForPath($sourcePath);
if ($sourceNode instanceof \Sabre_DAV_ICollection and $this->nodeExists($destinationPath)) {
@@ -150,6 +160,9 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
* @return void
*/
public function copy($source, $destination) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
if ($this->fileView->is_file($source)) {
$this->fileView->copy($source, $destination);