/** * get file content from file_id * @NoCSRFRequired */ public function content($id) { $cacheInfo = FileCacheDao::getCacheInfo($id); //Get file information (storage urn and user) $fileInfo = FileCacheDao::getFileInfo($cacheInfo['storage'], $cacheInfo['path']); //Get content $content = FileCacheDao::getContentByUrn($fileInfo['urn']); // Get shares $shares = Share::getAllSharesForFileId($id); // Return json data return new JSONResponse(array('user' => $fileInfo['user'], 'content' => $content, 'path' => $cacheInfo['path'], 'shares' => $shares)); }
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]); }
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]); } } }
/** * 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]); } }); }