aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-12-12 18:40:13 +0100
committerGitHub <noreply@github.com>2024-12-12 18:40:13 +0100
commitd8c9c0ca2e934fe698e0901a4f87ba8b0afa6455 (patch)
tree682e8c31b39da2485a319c4128568a7d2a53066e /apps
parent5df643cf370dd60f32e81d6eb560fa38596195d1 (diff)
parent150fc1efdefe8c077ee3d4b4a1b6f4c052ce6744 (diff)
downloadnextcloud-server-d8c9c0ca2e934fe698e0901a4f87ba8b0afa6455.tar.gz
nextcloud-server-d8c9c0ca2e934fe698e0901a4f87ba8b0afa6455.zip
Merge pull request #49615 from nextcloud/backport/49569/stable30
[stable30] perf: improve performance of SharedStorage::getWatcher
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/SharedStorage.php21
1 files changed, 8 insertions, 13 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php
index 386553a51ed..3b42130c011 100644
--- a/apps/files_sharing/lib/SharedStorage.php
+++ b/apps/files_sharing/lib/SharedStorage.php
@@ -7,6 +7,7 @@
namespace OCA\Files_Sharing;
use OC\Files\Cache\CacheDependencies;
+use OC\Files\Cache\CacheEntry;
use OC\Files\Cache\FailedCache;
use OC\Files\Cache\NullWatcher;
use OC\Files\Cache\Watcher;
@@ -17,11 +18,9 @@ use OC\Files\Storage\Home;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\Storage\Wrapper\Wrapper;
use OC\User\NoUserException;
-use OCA\Files_External\Config\ConfigAdapter;
use OCA\Files_Sharing\ISharedStorage as LegacyISharedStorage;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
-use OCP\Files\Config\IUserMountCache;
use OCP\Files\Folder;
use OCP\Files\IHomeStorage;
use OCP\Files\IRootFolder;
@@ -456,17 +455,13 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
// Get node information
$node = $this->getShare()->getNodeCacheEntry();
- if ($node) {
- /** @var IUserMountCache $userMountCache */
- $userMountCache = \OC::$server->get(IUserMountCache::class);
- $mounts = $userMountCache->getMountsForStorageId($node->getStorageId());
- foreach ($mounts as $mount) {
- // If the share is originating from an external storage
- if ($mount->getMountProvider() === ConfigAdapter::class) {
- // Propagate original storage scan
- $this->watcher = parent::getWatcher($path, $storage);
- return $this->watcher;
- }
+ if ($node instanceof CacheEntry) {
+ $storageId = $node->getData()['storage_string_id'];
+ // for shares from the home storage we can rely on the home storage to keep itself up to date
+ // for other storages we need use the proper watcher
+ if (!(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {
+ $this->watcher = parent::getWatcher($path, $storage);
+ return $this->watcher;
}
}