Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions lib/private/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

namespace OC\Files;

use OCA\Files_Sharing\SharedStorage;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Mount\IMountPoint;
use OCP\IUser;
Expand Down Expand Up @@ -73,6 +74,8 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
*/
private $childEtags = [];

private $includeShareSubMounts = true;

/**
* @var IMountPoint[]
*/
Expand Down Expand Up @@ -162,7 +165,7 @@ public function getInternalPath() {
* @return int|null
*/
public function getId() {
return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null;
return isset($this->data['fileid']) ? (int)$this->data['fileid'] : null;
}

/**
Expand Down Expand Up @@ -216,7 +219,7 @@ public function getSize($includeMounts = true) {
*/
public function getMTime() {
$this->updateEntryfromSubMounts();
return (int) $this->data['mtime'];
return (int)$this->data['mtime'];
}

/**
Expand All @@ -232,18 +235,18 @@ public function isEncrypted() {
* @return int
*/
public function getEncryptedVersion() {
return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
return isset($this->data['encryptedVersion']) ? (int)$this->data['encryptedVersion'] : 1;
}

/**
* @return int
*/
public function getPermissions() {
$perms = (int) $this->data['permissions'];
$perms = (int)$this->data['permissions'];
if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
}
return (int) $perms;
return (int)$perms;
}

/**
Expand Down Expand Up @@ -352,6 +355,10 @@ public function getOwner() {
return $this->owner;
}

public function setIncludeShareSubMounts(bool $include) {
$this->includeShareSubMounts = $include;
}

/**
* @param IMountPoint[] $mounts
*/
Expand All @@ -366,7 +373,7 @@ private function updateEntryfromSubMounts() {
$this->subMountsUsed = true;
foreach ($this->subMounts as $mount) {
$subStorage = $mount->getStorage();
if ($subStorage) {
if ($subStorage && ($this->includeShareSubMounts || !($subStorage instanceof SharedStorage))) {
$subCache = $subStorage->getCache('');
$rootEntry = $subCache->get('');
$this->addSubEntry($rootEntry, $mount->getMountPoint());
Expand Down Expand Up @@ -408,10 +415,10 @@ public function getExtension(): string {
}

public function getCreationTime(): int {
return (int) $this->data['creation_time'];
return (int)$this->data['creation_time'];
}

public function getUploadTime(): int {
return (int) $this->data['upload_time'];
return (int)$this->data['upload_time'];
}
}
7 changes: 2 additions & 5 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1400,12 +1400,9 @@ public function getFileInfo($path, $includeMountPoints = true) {
if ($data and isset($data['fileid'])) {
if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mount points to the folder
$extOnly = ($includeMountPoints === 'ext');
$info->setIncludeShareSubMounts($includeMountPoints !== 'ext');
$mounts = Filesystem::getMountManager()->findIn($path);
$info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) {
$subStorage = $mount->getStorage();
return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage);
}));
$info->setSubMounts($mounts);
}
}

Expand Down