]> source.dussan.org Git - nextcloud-server.git/commitdiff
lacy initialization of fileView - in case basic auth is used FileSystem is not yet...
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 26 Aug 2013 18:21:16 +0000 (20:21 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 26 Aug 2013 18:21:16 +0000 (20:21 +0200)
lib/connector/sabre/quotaplugin.php

index c8ce65a85767dd1f1f7a5f52e8d41bc4ce9024e4..ea2cb81d1f7532a79e86b1047a84ce2761f8297e 100644 (file)
@@ -40,9 +40,6 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
 
                $server->subscribeEvent('beforeWriteContent', array($this, 'checkQuota'), 10);
                $server->subscribeEvent('beforeCreateFile', array($this, 'checkQuota'), 10);
-
-               // initialize fileView
-               $this->fileView = \OC\Files\Filesystem::getView();
        }
 
        /**
@@ -59,7 +56,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
                                $uri='/'.$uri;
                        }
                        list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
-                       $freeSpace = $this->fileView->free_space($parentUri);
+                       $freeSpace = $this->getFreeSpace($parentUri);
                        if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) {
                                throw new Sabre_DAV_Exception_InsufficientStorage();
                        }
@@ -82,4 +79,19 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
 
                return $length;
        }
+
+       /**
+        * @param $parentUri
+        * @return mixed
+        */
+       public function getFreeSpace($parentUri)
+       {
+               if (is_null($this->fileView)) {
+                       // initialize fileView
+                       $this->fileView = \OC\Files\Filesystem::getView();
+               }
+
+               $freeSpace = $this->fileView->free_space($parentUri);
+               return $freeSpace;
+       }
 }