/** * Makes extra sure that we can actually do something with the file * * @param Node $node * * @throws NotFoundServiceException */ private function validateNode($node) { if (!$node->getMimetype() || !$node->isReadable()) { throw new NotFoundServiceException("Can't access the file"); } }
/** * Determines if the node is available, as in readable * * @todo Test to see by how much using file_exists slows things down * * @param Node $node * * @return bool */ private function isAvailable($node) { return $node->isReadable(); }
/** * Determines if the files are hosted locally (shared or not) * * isMounted() doesn't include externally hosted shares, so we need to exclude those from the * non-mounted nodes * * @param Node $node * * @return bool */ protected function isAllowedAndAvailable($node) { try { if (!$node->isMounted()) { $allowed = $node->isReadable(); if ($this->isExternalShare($node)) { $allowed = $allowed && $this->isExternalShareAllowed(); } return $allowed; } } catch (\Exception $exception) { $message = 'The folder is not available: ' . $exception->getMessage(); $this->logger->error($message); return false; } return false; }