diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-04-04 10:18:02 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-04-04 10:18:02 +0200 |
commit | 8a10c44eb33d45e2deba7d72b30e509fa332fb24 (patch) | |
tree | 0c874e8d186c4afd62a819b39fd0ff5e7ee4bc1b | |
parent | 0805f678ccfc808d788611aabc486f8dcef054e5 (diff) | |
parent | da5541ac025e5f5f9dbd7318b903266eedbed263 (diff) | |
download | nextcloud-server-8a10c44eb33d45e2deba7d72b30e509fa332fb24.tar.gz nextcloud-server-8a10c44eb33d45e2deba7d72b30e509fa332fb24.zip |
Merge pull request #8015 from owncloud/storageinfo-reuse
Allow reusing FileInfo for getStorageInfo
-rw-r--r-- | apps/files/index.php | 4 | ||||
-rw-r--r-- | lib/private/helper.php | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index 7d25c816eb7..b8ff08c1b05 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -39,7 +39,7 @@ OCP\App::setActiveNavigationEntry('files_index'); // Load the files $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; $dir = \OC\Files\Filesystem::normalizePath($dir); -$dirInfo = \OC\Files\Filesystem::getFileInfo($dir); +$dirInfo = \OC\Files\Filesystem::getFileInfo($dir, false); // Redirect if directory does not exist if (!$dirInfo || !$dirInfo->getType() === 'dir') { header('Location: ' . OCP\Util::getScriptName() . ''); @@ -70,7 +70,7 @@ $config = \OC::$server->getConfig(); $permissions = $dirInfo->getPermissions(); // information about storage capacities -$storageInfo=OC_Helper::getStorageInfo($dir); +$storageInfo=OC_Helper::getStorageInfo($dir, $dirInfo); $freeSpace=$storageInfo['free']; $uploadLimit=OCP\Util::uploadLimit(); $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir, $freeSpace); diff --git a/lib/private/helper.php b/lib/private/helper.php index d7ac0b5f4fa..da3d3cd1c6e 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -875,12 +875,15 @@ class OC_Helper { * Calculate the disc space for the given path * * @param string $path + * @param \OCP\Files\FileInfo $rootInfo (optional) * @return array */ - public static function getStorageInfo($path) { + public static function getStorageInfo($path, $rootInfo = null) { // return storage info without adding mount points - $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); - $used = $rootInfo['size']; + if (is_null($rootInfo)) { + $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); + } + $used = $rootInfo->getSize(); if ($used < 0) { $used = 0; } |