Skip to content
Snippets Groups Projects
Commit d1a6d2bc authored by Thomas Müller's avatar Thomas Müller
Browse files

lacy initialization of fileView - in case basic auth is used FileSystem is not...

lacy initialization of fileView - in case basic auth is used FileSystem is not yet initialized during the initialize() call
parent 9e1016f7
No related branches found
No related tags found
No related merge requests found
...@@ -40,9 +40,6 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { ...@@ -40,9 +40,6 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
$server->subscribeEvent('beforeWriteContent', array($this, 'checkQuota'), 10); $server->subscribeEvent('beforeWriteContent', array($this, 'checkQuota'), 10);
$server->subscribeEvent('beforeCreateFile', 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 { ...@@ -59,7 +56,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
$uri='/'.$uri; $uri='/'.$uri;
} }
list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($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) { if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) {
throw new Sabre_DAV_Exception_InsufficientStorage(); throw new Sabre_DAV_Exception_InsufficientStorage();
} }
...@@ -82,4 +79,19 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { ...@@ -82,4 +79,19 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
return $length; 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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment