From 88f03192ba1f74a5ab8881c0c1cbb3b2203f9f3f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Sep 2015 16:43:41 +0200 Subject: [PATCH 1/2] Delay listening to owner changes untill we use a share for that owner --- apps/files_sharing/lib/mountprovider.php | 3 +-- apps/files_sharing/lib/sharedstorage.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/mountprovider.php b/apps/files_sharing/lib/mountprovider.php index 14a79625993..458e7f2619b 100644 --- a/apps/files_sharing/lib/mountprovider.php +++ b/apps/files_sharing/lib/mountprovider.php @@ -69,12 +69,11 @@ class MountProvider implements IMountProvider { // for updating etags for the share owner when we make changes to this share. $ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']); - // for updating our etags when changes are made to the share from the owners side (probably indirectly by us trough another share) - $this->propagationManager->listenToOwnerChanges($share['uid_owner'], $user->getUID()); return new SharedMount( '\OC\Files\Storage\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array( + 'propagationManager' => $this->propagationManager, 'propagator' => $ownerPropagator, 'share' => $share, 'user' => $user->getUID() diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 1ac401f3cf8..47f3bcf7602 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -50,13 +50,28 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { */ private $ownerView; + /** + * @var \OCA\Files_Sharing\Propagation\PropagationManager + */ + private $propagationManager; + + /** + * @var string + */ + private $user; + public function __construct($arguments) { $this->share = $arguments['share']; $this->ownerView = $arguments['ownerView']; + $this->propagationManager = $arguments['propagationManager']; + $this->user = $arguments['user']; } private function init() { Filesystem::initMountPoints($this->share['uid_owner']); + + // for updating our etags when changes are made to the share from the owners side (probably indirectly by us trough another share) + $this->propagationManager->listenToOwnerChanges($this->share['uid_owner'], $this->user); } /** From 7d53427ee6ff1a61e005423da952b49b7b8d3147 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Sep 2015 16:48:45 +0200 Subject: [PATCH 2/2] only initialize once --- apps/files_sharing/lib/sharedstorage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 47f3bcf7602..27dd2f1e485 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -60,6 +60,8 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { */ private $user; + private $initialized = false; + public function __construct($arguments) { $this->share = $arguments['share']; $this->ownerView = $arguments['ownerView']; @@ -68,6 +70,10 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { } private function init() { + if ($this->initialized) { + return; + } + $this->initialized = true; Filesystem::initMountPoints($this->share['uid_owner']); // for updating our etags when changes are made to the share from the owners side (probably indirectly by us trough another share)