$server->subscribeEvent('beforeWriteContent', array($this, 'checkQuota'), 10);
$server->subscribeEvent('beforeCreateFile', array($this, 'checkQuota'), 10);
-
- // initialize fileView
- $this->fileView = \OC\Files\Filesystem::getView();
}
/**
$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();
}
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;
+ }
}