summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-10-23 13:22:23 +0200
committerRobin Appelman <robin@icewind.nl>2023-11-09 15:42:41 +0100
commit81d625d44d2b177b58b095da21ce100057a1755b (patch)
tree6393c576a5ad8742a96accd378f75555717305aa /lib
parentbdba3f1e2f31b930e019c7b5e18032bdcb93539b (diff)
downloadnextcloud-server-81d625d44d2b177b58b095da21ce100057a1755b.tar.gz
nextcloud-server-81d625d44d2b177b58b095da21ce100057a1755b.zip
optimize isShared and isMounted
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/FileInfo.php23
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index 09a29113485..29922ee30eb 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -32,6 +32,8 @@
*/
namespace OC\Files;
+use OC\Files\Mount\HomeMountPoint;
+use OCA\Files_Sharing\ISharedMountPoint;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Mount\IMountPoint;
use OCP\IUser;
@@ -309,27 +311,12 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return bool
*/
public function isShared() {
- $sid = $this->getStorage()->getId();
- if (!is_null($sid)) {
- $sid = explode(':', $sid);
- return ($sid[0] === 'shared');
- }
-
- return false;
+ return $this->mount instanceof ISharedMountPoint;
}
public function isMounted() {
- $storage = $this->getStorage();
- if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
- return false;
- }
- $sid = $storage->getId();
- if (!is_null($sid)) {
- $sid = explode(':', $sid);
- return ($sid[0] !== 'home' and $sid[0] !== 'shared');
- }
-
- return false;
+ $isHome = $this->mount instanceof HomeMountPoint;
+ return !$isHome && !$this->isShared();
}
/**