function testNameContainsDot()
 {
     $r = new Rule_FRSFileName();
     $this->assertFalse($r->isValid('../coin'));
     $this->assertFalse(util_is_valid_filename('../coin'));
     $this->assertFalse($r->isValid('zata/../toto'));
     $this->assertFalse(util_is_valid_filename('zata/../toto'));
 }
 /**
  * Create a new file based on given objects
  *
  * Given a "transient" file object, physically move the file from it's landing zone to
  * it's release area and create the corresponding entry in the database.
  *
  * @param FRSFile    $file    File to create
  *
  * @return FRSFile
  */
 public function createFile(FRSFile $file, $extraFlags = self::COMPUTE_MD5)
 {
     $rule = new Rule_FRSFileName();
     if (!$rule->isValid($file->getFileName())) {
         throw new FRSFileIllegalNameException($file);
     }
     $rel = $file->getRelease();
     if ($this->isFileBaseNameExists($file->getFileName(), $rel->getReleaseID(), $rel->getGroupID())) {
         throw new FRSFileExistsException($file);
     }
     if ($this->isSameFileMarkedToBeRestored($file->getFileName(), $rel->getReleaseID(), $rel->getGroupID())) {
         throw new FRSFileToBeRestoredException($file);
     }
     clearstatcache();
     $filePath = $this->getSrcDir($rel->getProject()) . '/' . $file->getFileName();
     if (!file_exists($filePath)) {
         throw new FRSFileInvalidNameException($file);
     }
     if (0 != ($extraFlags & self::COMPUTE_MD5)) {
         $file->setComputedMd5(PHP_BigFile::getMd5Sum($filePath));
         if (!$this->compareMd5Checksums($file->getComputedMd5(), $file->getReferenceMd5())) {
             throw new FRSFileMD5SumException($file);
         }
     }
     $file->setFileSize(PHP_BigFile::getSize($filePath));
     $file->setStatus('A');
     if ($this->moveFileForge($file)) {
         $fileId = $this->create($file->toArray());
         if ($fileId) {
             $file->setFileID($fileId);
             return $file;
         } else {
             throw new FRSFileDbException($file);
         }
     } else {
         throw new FRSFileForgeException($file);
     }
 }