summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/getstoragestats.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-11 16:47:28 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-11 16:47:28 +0100
commite560cba76beb918a2c127b931b6d409abd9f03ab (patch)
tree87cc9214ae6bb2a5c19c3f7230d704cd3e48b817 /apps/files/ajax/getstoragestats.php
parent938254a1c015c447b24fe1f3e64d8026f4dda8c3 (diff)
downloadnextcloud-server-e560cba76beb918a2c127b931b6d409abd9f03ab.tar.gz
nextcloud-server-e560cba76beb918a2c127b931b6d409abd9f03ab.zip
adding a ajax call to get the current file storage stats like free space
logic to call it every 5 minutes make use of visibility API/jquery-visibility to perform the ajax call only if the browser is visible/in use
Diffstat (limited to 'apps/files/ajax/getstoragestats.php')
-rw-r--r--apps/files/ajax/getstoragestats.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files/ajax/getstoragestats.php b/apps/files/ajax/getstoragestats.php
new file mode 100644
index 00000000000..e55e346ed67
--- /dev/null
+++ b/apps/files/ajax/getstoragestats.php
@@ -0,0 +1,16 @@
+<?php
+
+// only need filesystem apps
+$RUNTIME_APPTYPES = array('filesystem');
+
+OCP\JSON::checkLoggedIn();
+
+$l=new OC_L10N('files');
+$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
+$maxHumanFilesize = OCP\Util::humanFileSize($maxUploadFilesize);
+$maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize;
+
+// send back json
+OCP\JSON::success(array('data' => array('uploadMaxFilesize' => $maxUploadFilesize,
+ 'maxHumanFilesize' => $maxHumanFilesize
+)));