diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-04-02 17:10:57 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-04-02 17:10:57 +0200 |
commit | da5541ac025e5f5f9dbd7318b903266eedbed263 (patch) | |
tree | 124d77443579674234f9d48d86268d0f5205cbc6 | |
parent | 16d10844cd01dc89f864cda6bde5169812e89b62 (diff) | |
download | nextcloud-server-da5541ac025e5f5f9dbd7318b903266eedbed263.tar.gz nextcloud-server-da5541ac025e5f5f9dbd7318b903266eedbed263.zip |
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 4d765b69e41..f2c5bd13359 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -38,7 +38,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() . ''); @@ -94,7 +94,7 @@ $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir $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); 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; } |