aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-21 15:38:02 -0800
committerfriendica <info@friendica.com>2014-01-21 15:38:02 -0800
commit0dbbe007e8fa1cf9e1fd514624c7600e3f87f0f1 (patch)
tree9823b291275abe18df4f10ebca3624d5cad7ddfa /include
parente96025646611ddf2d0aaa5caa2f6a955dcd8e4ce (diff)
downloadvolse-hubzilla-0dbbe007e8fa1cf9e1fd514624c7600e3f87f0f1.tar.gz
volse-hubzilla-0dbbe007e8fa1cf9e1fd514624c7600e3f87f0f1.tar.bz2
volse-hubzilla-0dbbe007e8fa1cf9e1fd514624c7600e3f87f0f1.zip
add the quota and volume size code
Diffstat (limited to 'include')
-rw-r--r--include/reddav.php30
1 files changed, 29 insertions, 1 deletions
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
+ );
+
+ }
}