コード例 #1
0
ファイル: service.php プロジェクト: drognisep/Portfolio-Site
 /**
  * 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");
     }
 }
コード例 #2
0
ファイル: filesservice.php プロジェクト: efueger/galleryplus
 /**
  * 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();
 }
コード例 #3
0
ファイル: filesservice.php プロジェクト: AARNet/galleryplus
 /**
  * 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;
 }