本文整理匯總了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]);
}
});
}