From 0dbbe007e8fa1cf9e1fd514624c7600e3f87f0f1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 21 Jan 2014 15:38:02 -0800 Subject: add the quota and volume size code --- include/reddav.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index a937360a8..daa7fd734 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -5,7 +5,7 @@ require_once('vendor/autoload.php'); require_once('include/attach.php'); -class RedDirectory extends DAV\Node implements DAV\ICollection { +class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { private $red_path; private $folder_hash; @@ -297,6 +297,34 @@ class RedDirectory extends DAV\Node implements DAV\ICollection { } + public function getQuotaInfo() { + + $limit = disk_total_space('store'); + $free = disk_free_space('store'); + + if($this->auth->owner_id) { + + $c = q("select * from channel where channel_id = %d and not (channel_pageflags & %d) limit 1", + intval($this->auth->owner_id), + intval(PAGE_REMOVED) + + ); + + $ulimit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit'); + $limit = (($ulimit) ? $ulimit : $limit); + + $x = q("select sum(filesize) as total from attach where aid = %d ", + intval($c[0]['channel_account_id']) + ); + $free = (($x) ? $limit - $x[0]['total'] : 0); + } + + return array( + $limit - $free, + $free + ); + + } } -- cgit v1.2.3