summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-11-18 14:42:40 -0800
committerMorris Jobke <morris.jobke@gmail.com>2013-11-18 14:42:40 -0800
commit4a0d295e4ad2546049919a893ad219944466536a (patch)
tree876b5b0004e226181161fe8880e8120a17c59588
parentcdc72ddd8d9eeeb3d1bd0d875471bd90463622c9 (diff)
parent614e4d485c8b74f6879c401f8cbb93e9335bf9b3 (diff)
downloadnextcloud-server-4a0d295e4ad2546049919a893ad219944466536a.tar.gz
nextcloud-server-4a0d295e4ad2546049919a893ad219944466536a.zip
Merge pull request #5927 from owncloud/quota-excludeextstorage
External storage space is now not counted in total space
-rw-r--r--lib/private/files.php4
-rw-r--r--lib/private/files/filesystem.php6
-rw-r--r--lib/private/files/view.php6
-rw-r--r--lib/private/helper.php3
-rw-r--r--tests/lib/files/view.php5
5 files changed, 17 insertions, 7 deletions
diff --git a/lib/private/files.php b/lib/private/files.php
index c705d2adb1a..8b4d5c59aee 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -28,8 +28,8 @@
class OC_Files {
static $tmpFiles = array();
- static public function getFileInfo($path){
- return \OC\Files\Filesystem::getFileInfo($path);
+ static public function getFileInfo($path, $includeMountPoints = true){
+ return \OC\Files\Filesystem::getFileInfo($path, $includeMountPoints);
}
static public function getDirectoryContent($path){
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 8500b3c581b..a83e9aa86d2 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -725,6 +725,8 @@ class Filesystem {
* get the filesystem info
*
* @param string $path
+ * @param boolean $includeMountPoints whether to add mountpoint sizes,
+ * defaults to true
* @return array
*
* returns an associative array with the following keys:
@@ -734,8 +736,8 @@ class Filesystem {
* - encrypted
* - versioned
*/
- public static function getFileInfo($path) {
- return self::$defaultInstance->getFileInfo($path);
+ public static function getFileInfo($path, $includeMountPoints = true) {
+ return self::$defaultInstance->getFileInfo($path, $includeMountPoints);
}
/**
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index c0b9f0fc9c8..8cb56ede91b 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -762,6 +762,8 @@ class View {
* get the filesystem info
*
* @param string $path
+ * @param boolean $includeMountPoints whether to add mountpoint sizes,
+ * defaults to true
* @return array
*
* returns an associative array with the following keys:
@@ -771,7 +773,7 @@ class View {
* - encrypted
* - versioned
*/
- public function getFileInfo($path) {
+ public function getFileInfo($path, $includeMountPoints = true) {
$data = array();
if (!Filesystem::isValidPath($path)) {
return $data;
@@ -798,7 +800,7 @@ class View {
$data = $cache->get($internalPath);
if ($data and $data['fileid']) {
- if ($data['mimetype'] === 'httpd/unix-directory') {
+ if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mountpoints to the folder
$mountPoints = Filesystem::getMountPoints($path);
foreach ($mountPoints as $mountPoint) {
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 48031c1467f..c82d3bd4ef4 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -876,7 +876,8 @@ class OC_Helper {
* @return array
*/
public static function getStorageInfo($path) {
- $rootInfo = \OC\Files\Filesystem::getFileInfo($path);
+ // return storage info without adding mount points
+ $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
$used = $rootInfo['size'];
if ($used < 0) {
$used = 0;
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 0cc86d6651a..f358c15dd50 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -67,6 +67,11 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals($storageSize * 3, $cachedData['size']);
$this->assertEquals('httpd/unix-directory', $cachedData['mimetype']);
+ // get cached data excluding mount points
+ $cachedData = $rootView->getFileInfo('/', false);
+ $this->assertEquals($storageSize, $cachedData['size']);
+ $this->assertEquals('httpd/unix-directory', $cachedData['mimetype']);
+
$cachedData = $rootView->getFileInfo('/folder');
$this->assertEquals($storageSize + $textSize, $cachedData['size']);
$this->assertEquals('httpd/unix-directory', $cachedData['mimetype']);