Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-24 17:10:19 +0400
committerRobin Appelman <icewind@owncloud.com>2012-02-25 02:54:38 +0400
commit9f5bce81b037624099012038f1ebfeb94d3317fd (patch)
treee8917f2547939a1d9b991aa548972990fe323392 /lib/fileproxy
parente039015ca1d600a227b4cd0665192f3e22f3d1f2 (diff)
add a default user quota
Diffstat (limited to 'lib/fileproxy')
-rw-r--r--lib/fileproxy/quota.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index 94a49176ee6..9e4c2d0643e 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -26,11 +26,37 @@
*/
class OC_FileProxy_Quota extends OC_FileProxy{
+ private $userQuota=-1;
+
+ /**
+ * get the quota for the current user
+ * @return int
+ */
+ private function getQuota(){
+ if($this->userQuota!=-1){
+ return $this->userQuota;
+ }
+ $userQuota=OC_Preferences::getValue(OC_User::getUser(),'files','quota','default');
+ if($userQuota=='default'){
+ $userQuota=OC_AppConfig::getValue('files','default_quota','none');
+ }
+ if($userQuota=='none'){
+ $this->userQuota=0;
+ }else{
+ $this->userQuota=OC_Helper::computerFileSize($userQuota);
+ }
+ return $this->userQuota;
+
+ }
+
+ /**
+ * get the free space in the users home folder
+ * @return int
+ */
private function getFreeSpace(){
$rootInfo=OC_FileCache::get('');
$usedSpace=$rootInfo['size'];
- $totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0);
- $totalSpace=OC_Helper::computerFileSize($totalSpace);
+ $totalSpace=$this->getQuota();
if($totalSpace==0){
return 0;
}