Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c80ba69
dont setup full fs after dav auth
icewind1991 Mar 8, 2022
46d0eef
allow setting some metadata in the lazyfolder without having to get t…
icewind1991 Mar 8, 2022
3fc5c97
return a lazy folder from Root::getUserFolder
icewind1991 Mar 8, 2022
04052a9
allow getting cached mounts by path from the mount cache
icewind1991 Mar 8, 2022
469a684
allow getting mounts by provider
icewind1991 Mar 8, 2022
55d943f
fixed when accessing static filesystem calls before setup
icewind1991 Mar 8, 2022
19c64cf
setup only relevant mounts when possible
icewind1991 Mar 8, 2022
79f6742
improve lazy UserFolder
icewind1991 Mar 9, 2022
a617e1e
fix check if dav root is folder
icewind1991 Mar 9, 2022
506d29c
update cached mounts when only specific providers have been setup
icewind1991 Mar 10, 2022
6b085b6
add logic to perform a full filesystem setup when needed
icewind1991 Mar 10, 2022
d342c76
don't double setup provider when calling `setupForUser` after `setupF…
icewind1991 Mar 14, 2022
15c9a31
perform full setup if a cached mount doesn't have a provider set
icewind1991 Mar 16, 2022
fc6e453
force full setup after external storage config change
icewind1991 Mar 17, 2022
89919b0
invalidate mount cache on circles change
icewind1991 Mar 17, 2022
70c37c2
fmt
icewind1991 Mar 17, 2022
f7c942a
caching of userfolder
icewind1991 Mar 24, 2022
63ad99b
fix method name
icewind1991 Mar 24, 2022
b7a7425
make mount cache duration configurable
icewind1991 Mar 24, 2022
db2418b
invalidate mount cache after share rename
icewind1991 Mar 24, 2022
1179873
add comment for getMountForPath loop
icewind1991 Mar 24, 2022
881e107
Apply suggestions from code review
icewind1991 Mar 24, 2022
1bc86a9
Make phpcs happy in MountProviderCollection
PVince81 Mar 24, 2022
d92c7bd
Add missing event dispatcher in test constructor
PVince81 Mar 24, 2022
91ab4e1
Add missing PHPDoc in InvalidateMountCacheEvent
PVince81 Mar 24, 2022
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
Prev Previous commit
Next Next commit
invalidate mount cache after share rename
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 24, 2022
commit db2418be85cab5eb0ec8f2ad00f821e79380526b
4 changes: 3 additions & 1 deletion apps/files_sharing/lib/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) {
],
$loader,
$view,
$foldersExistCache
$foldersExistCache,
$this->eventDispatcher,
$user
);

$event = new ShareMountedEvent($mount);
Expand Down
42 changes: 23 additions & 19 deletions apps/files_sharing/lib/SharedMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
use OC\Files\Mount\MoveableMount;
use OC\Files\View;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\InvalidateMountCacheEvent;
use OCP\Files\Storage\IStorageFactory;
use OCP\IUser;
use OCP\Share\Events\VerifyMountPointEvent;

/**
Expand All @@ -51,33 +53,35 @@ class SharedMount extends MountPoint implements MoveableMount {
*/
private $recipientView;

/**
* @var string
*/
private $user;
private IUser $user;

/** @var \OCP\Share\IShare */
private $superShare;

/** @var \OCP\Share\IShare[] */
private $groupedShares;

/**
* @param string $storage
* @param SharedMount[] $mountpoints
* @param array $arguments
* @param IStorageFactory $loader
* @param View $recipientView
*/
public function __construct($storage, array $mountpoints, $arguments, IStorageFactory $loader, View $recipientView, CappedMemoryCache $folderExistCache) {
$this->user = $arguments['user'];
private IEventDispatcher $eventDispatcher;

public function __construct(
$storage,
array $mountpoints,
$arguments,
IStorageFactory $loader,
View $recipientView,
CappedMemoryCache $folderExistCache,
IEventDispatcher $eventDispatcher,
IUser $user
) {
$this->user = $user;
$this->recipientView = $recipientView;
$this->eventDispatcher = $eventDispatcher;

$this->superShare = $arguments['superShare'];
$this->groupedShares = $arguments['groupedShares'];

$newMountPoint = $this->verifyMountPoint($this->superShare, $mountpoints, $folderExistCache);
$absMountPoint = '/' . $this->user . '/files' . $newMountPoint;
$absMountPoint = '/' . $user->getUID() . '/files' . $newMountPoint;
parent::__construct($storage, $absMountPoint, $arguments, $loader, null, null, MountProvider::class);
}

Expand All @@ -93,9 +97,7 @@ private function verifyMountPoint(\OCP\Share\IShare $share, array $mountpoints,
$parent = dirname($share->getTarget());

$event = new VerifyMountPointEvent($share, $this->recipientView, $parent);
/** @var IEventDispatcher $dispatcher */
$dispatcher = \OC::$server->query(IEventDispatcher::class);
$dispatcher->dispatchTyped($event);
$this->eventDispatcher->dispatchTyped($event);
$parent = $event->getParent();

if ($folderExistCache->hasKey($parent)) {
Expand All @@ -105,7 +107,7 @@ private function verifyMountPoint(\OCP\Share\IShare $share, array $mountpoints,
$folderExistCache->set($parent, $parentExists);
}
if (!$parentExists) {
$parent = Helper::getShareFolder($this->recipientView, $this->user);
$parent = Helper::getShareFolder($this->recipientView, $this->user->getUID());
}

$newMountPoint = $this->generateUniqueTarget(
Expand Down Expand Up @@ -133,8 +135,10 @@ private function updateFileTarget($newPath, &$share) {

foreach ($this->groupedShares as $tmpShare) {
$tmpShare->setTarget($newPath);
\OC::$server->getShareManager()->moveShare($tmpShare, $this->user);
\OC::$server->getShareManager()->moveShare($tmpShare, $this->user->getUID());
}

$this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent($this->user));
}


Expand Down