Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/FileInfo.php')
-rw-r--r--lib/private/Files/FileInfo.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index 575af56ceb5..19b95cd0355 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -81,6 +81,13 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
private $subMountsUsed = false;
/**
+ * The size of the file/folder without any sub mount
+ *
+ * @var int
+ */
+ private $rawSize = 0;
+
+ /**
* @param string|boolean $path
* @param Storage\Storage $storage
* @param string $internalPath
@@ -95,6 +102,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
$this->data = $data;
$this->mount = $mount;
$this->owner = $owner;
+ $this->rawSize = $this->data['size'] ?? 0;
}
public function offsetSet($offset, $value) {
@@ -194,9 +202,13 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
/**
* @return int
*/
- public function getSize() {
- $this->updateEntryfromSubMounts();
- return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
+ public function getSize($includeMounts = true) {
+ if ($includeMounts) {
+ $this->updateEntryfromSubMounts();
+ return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
+ } else {
+ return $this->rawSize;
+ }
}
/**