本文整理汇总了PHP中OCP\Files\Folder::searchByTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::searchByTag方法的具体用法?PHP Folder::searchByTag怎么用?PHP Folder::searchByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Files\Folder
的用法示例。
在下文中一共展示了Folder::searchByTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilesByTag
/**
* Updates the tags of the specified file path.
* The passed tags are absolute, which means they will
* replace the actual tag selection.
*
* @param array $tagName tag name to filter by
* @return FileInfo[] list of matching files
* @throws \Exception if the tag does not exist
*/
public function getFilesByTag($tagName)
{
$nodes = $this->homeFolder->searchByTag($tagName, $this->userSession->getUser()->getUId());
foreach ($nodes as &$node) {
$node = $node->getFileInfo();
}
return $nodes;
}
示例2: getFilesByTag
/**
* Updates the tags of the specified file path.
* The passed tags are absolute, which means they will
* replace the actual tag selection.
*
* @param array $tagName tag name to filter by
* @return FileInfo[] list of matching files
* @throws \Exception if the tag does not exist
*/
public function getFilesByTag($tagName)
{
$nodes = $this->homeFolder->searchByTag($tagName, $this->userSession->getUser()->getUId());
$fileInfos = [];
foreach ($nodes as $node) {
try {
/** @var \OC\Files\Node\Node $node */
$fileInfos[] = $node->getFileInfo();
} catch (\Exception $e) {
// FIXME Should notify the user, when this happens
// Can not get FileInfo, maybe the connection to the external
// storage is interrupted.
}
}
return $fileInfos;
}