summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-27 15:56:57 +0100
committerRobin Appelman <icewind@owncloud.com>2014-01-27 15:56:57 +0100
commit3c1ab66edac1ba2f1b398c859cd933c410ea3d8d (patch)
treebdd26dd256e1668751dde67d848ac4ab2a191c11 /lib/private/helper.php
parentd182b4f59fd7b172764a4d802dbd3ee6a953ea39 (diff)
downloadnextcloud-server-3c1ab66edac1ba2f1b398c859cd933c410ea3d8d.tar.gz
nextcloud-server-3c1ab66edac1ba2f1b398c859cd933c410ea3d8d.zip
Reuse the calculated free_space in buildFileStorageStatistics
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 1c8d01c141f..12784c9a5eb 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -824,13 +824,16 @@ 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
+ * @param string $dir the current folder where the user currently operates
+ * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
* @return number of bytes representing
*/
- public static function maxUploadFilesize($dir) {
+ public static function maxUploadFilesize($dir, $freeSpace = null) {
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
- $freeSpace = \OC\Files\Filesystem::free_space($dir);
+ if (is_null($freeSpace)) {
+ $freeSpace = \OC\Files\Filesystem::free_space($dir);
+ }
if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
$maxUploadFilesize = \OC\Files\SPACE_UNLIMITED;
} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {