public function propagateById($id) { $shares = Share::getAllSharesForFileId($id); foreach ($shares as $share) { // propagate down the share tree $this->markDirty($share, microtime(true)); // propagate up the share tree if ($share['share_with'] === $this->userId) { $user = $share['uid_owner']; $view = new View('/' . $user . '/files'); $path = $view->getPath($share['file_source']); $watcher = new ChangeWatcher($view, $this->manager->getSharePropagator($user)); $watcher->writeHook(['path' => $path]); } } }
public function propagateById($id) { if (isset($this->propagatingIds[$id])) { return; } $this->propagatingIds[$id] = true; $shares = Share::getAllSharesForFileId($id); foreach ($shares as $share) { // propagate down the share tree $this->markDirty($share, microtime(true)); // propagate up the share tree if ($this->isRecipientOfShare($share)) { $user = $share['uid_owner']; $view = new View('/' . $user . '/files'); $path = $view->getPath($share['file_source']); $watcher = new ChangeWatcher($view, $this->manager->getSharePropagator($user)); $watcher->writeHook(['path' => $path]); } } unset($this->propagatingIds[$id]); }
/** * Listen on the propagator for updates made to shares owned by a user * * @param \OC\Files\Cache\ChangePropagator $propagator * @param string $owner */ public function attachToPropagator(ChangePropagator $propagator, $owner) { $propagator->listen('\\OC\\Files', 'propagate', function ($path, $entry) use($owner) { $shares = Share::getAllSharesForFileId($entry['fileid']); foreach ($shares as $share) { // propagate down the share tree $this->markDirty($share, microtime(true)); // propagate up the share tree $user = $share['uid_owner']; $view = new View('/' . $user . '/files'); $path = $view->getPath($share['file_source']); $watcher = new ChangeWatcher($view); $watcher->writeHook(['path' => $path]); } }); }