diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-08-26 20:21:16 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-08-26 20:21:16 +0200 |
commit | d1a6d2bc8fce5cefe828f09a77a8b9c9172b5c57 (patch) | |
tree | 785b66ec652e4aaa1de9751154712954aa8a9e7f /lib/connector/sabre/quotaplugin.php | |
parent | 9e1016f7d2aa7c23fc6287a563e6551809edcbe8 (diff) | |
download | nextcloud-server-d1a6d2bc8fce5cefe828f09a77a8b9c9172b5c57.tar.gz nextcloud-server-d1a6d2bc8fce5cefe828f09a77a8b9c9172b5c57.zip |
lacy initialization of fileView - in case basic auth is used FileSystem is not yet initialized during the initialize() call
Diffstat (limited to 'lib/connector/sabre/quotaplugin.php')
-rw-r--r-- | lib/connector/sabre/quotaplugin.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/connector/sabre/quotaplugin.php b/lib/connector/sabre/quotaplugin.php index c8ce65a8576..ea2cb81d1f7 100644 --- a/lib/connector/sabre/quotaplugin.php +++ b/lib/connector/sabre/quotaplugin.php @@ -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; + } } |