summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authoricewind1991 <robin@icewind.nl>2014-02-12 15:48:14 +0100
committericewind1991 <robin@icewind.nl>2014-02-12 15:48:14 +0100
commit7af456730eef4a1c947188c12d69a0caf0a5bd2b (patch)
tree48fd8ad0f58e14241f955c956f86fa9c83fce8ee /lib/private
parent3699728a3a02dd17ea617a7e8f781c09e837f360 (diff)
parent753af3a3ff17d9126a738f292b3922981bd5673d (diff)
downloadnextcloud-server-7af456730eef4a1c947188c12d69a0caf0a5bd2b.tar.gz
nextcloud-server-7af456730eef4a1c947188c12d69a0caf0a5bd2b.zip
Merge pull request #6964 from owncloud/storagestatistics-reuse
Reuse the calculated free_space in buildFileStorageStatistics
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/helper.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 580f81acc62..58cb1b88d66 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -804,18 +804,22 @@ class OC_Helper {
/**
* @brief calculates the maximum upload size respecting system settings, free space and user quota
*
- * @param $dir the current folder where the user currently operates
- * @return number of bytes representing
+ * @param string $dir the current folder where the user currently operates
+ * @param int $freeSpace the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
+ * @return int number of bytes representing
*/
- public static function maxUploadFilesize($dir) {
- return min(self::freeSpace($dir), self::uploadLimit());
+ public static function maxUploadFilesize($dir, $freeSpace = null) {
+ if (is_null($freeSpace)){
+ $freeSpace = self::freeSpace($dir);
+ }
+ return min($freeSpace, self::uploadLimit());
}
/**
* Calculate free space left within user quota
*
- * @param $dir the current folder where the user currently operates
- * @return number of bytes representing
+ * @param string $dir the current folder where the user currently operates
+ * @return int number of bytes representing
*/
public static function freeSpace($dir) {
$freeSpace = \OC\Files\Filesystem::free_space($dir);