/** * 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; }
/** * 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; }