本文整理汇总了PHP中OC\Share\Share::getAllSharesForFileId方法的典型用法代码示例。如果您正苦于以下问题:PHP Share::getAllSharesForFileId方法的具体用法?PHP Share::getAllSharesForFileId怎么用?PHP Share::getAllSharesForFileId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Share\Share
的用法示例。
在下文中一共展示了Share::getAllSharesForFileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* 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));
}
示例2: propagateById
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]);
}
示例3: propagateById
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]);
}
}
}
示例4: attachToPropagator
/**
* 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]);
}
});
}