Пример #1
0
 /**
  * Sets this header with the values from the ezcArchiveEntry $entry.
  *
  * The values that are possible to set from the ezcArchiveEntry $entry are set in this header.
  * The properties that may change are: fileName, fileMode, userId, groupId, fileSize, modificationTime,
  * linkName, and type.
  *
  * @param ezcArchiveEntry $entry
  * @return void
  */
 public function setHeaderFromArchiveEntry(ezcArchiveEntry $entry)
 {
     $this->splitFilePrefix($entry->getPath(false), $file, $filePrefix);
     $this->fileName = $file;
     $this->filePrefix = $filePrefix;
     $this->fileMode = $entry->getPermissions();
     $this->userId = $entry->getUserId();
     $this->groupId = $entry->getGroupId();
     $this->fileSize = $entry->getSize();
     $this->modificationTime = $entry->getModificationTime();
     $this->linkName = $entry->getLink(false);
     switch ($entry->getType()) {
         case ezcArchiveEntry::IS_FILE:
             $this->type = 0;
             break;
         case ezcArchiveEntry::IS_LINK:
             $this->type = 1;
             break;
         case ezcArchiveEntry::IS_SYMBOLIC_LINK:
             $this->type = 2;
             break;
         case ezcArchiveEntry::IS_CHARACTER_DEVICE:
             $this->type = 3;
             break;
         case ezcArchiveEntry::IS_BLOCK_DEVICE:
             $this->type = 4;
             break;
         case ezcArchiveEntry::IS_DIRECTORY:
             $this->type = 5;
             break;
         case ezcArchiveEntry::IS_FIFO:
             $this->type = 6;
             break;
             // Devices, etc are set to \0.
         // Devices, etc are set to \0.
         default:
             $this->type = "";
             break;
             // ends up as a \0 character.
     }
     $this->deviceMajorNumber = $entry->getMajor();
     $this->deviceMinorNumber = $entry->getMinor();
     $length = strlen($this->fileName);
     if ($entry->getType() == ezcArchiveEntry::IS_DIRECTORY) {
         // Make sure that the filename ends with a slash.
         if ($this->fileName[$length - 1] != "/") {
             $this->fileName .= "/";
         }
     } else {
         if ($this->fileName[$length - 1] == "/") {
             $this->fileName = substr($this->fileName, 0, -1);
             // Remove last character.
         }
     }
 }
Пример #2
0
 /**
  * Sets this header with the values from the ezcArchiveEntry $entry.
  *
  * The values that are possible to set from the ezcArchiveEntry $entry are set in this header.
  *
  * @param ezcArchiveEntry $entry
  * @return void
  */
 public function setHeaderFromArchiveEntry(ezcArchiveEntry $entry)
 {
     $this->version = 10;
     // FIXME
     $this->bitFlag = 0;
     // FIXME
     $this->atime = $entry->getAccessTime();
     $this->groupId = $entry->getGroupId();
     $this->userId = $entry->getUserId();
     $this->setModificationTime($entry->getModificationTime());
     if ($entry->isSymLink()) {
         $this->uncompressedSize = strlen($entry->getLink());
         $this->crc = ezcArchiveChecksums::getCrc32FromString($entry->getLink());
     } else {
         $this->uncompressedSize = $entry->getSize();
         $this->crc = ezcArchiveChecksums::getCrc32FromFile($entry->getPath());
     }
     $this->setFileName($entry->getPath(false));
 }
Пример #3
0
 /**
  * Sets this header with the values from the ezcArchiveEntry $entry.
  *
  * The values that are possible to set from the ezcArchiveEntry $entry are set in this header.
  * The properties that may change are: fileName, fileMode, userId, groupId, fileSize, modificationTime,
  * linkName, and type.
  *
  * @param ezcArchiveEntry $entry
  * @return void
  */
 public function setHeaderFromArchiveEntry(ezcArchiveEntry $entry)
 {
     $this->fileName = $entry->getPath(false);
     $this->fileMode = $entry->getPermissions();
     $this->userId = $entry->getUserId();
     $this->groupId = $entry->getGroupId();
     $this->fileSize = $entry->getSize();
     $this->modificationTime = $entry->getModificationTime();
     $this->linkName = $entry->getLink(false);
     switch ($entry->getType()) {
         case ezcArchiveEntry::IS_FILE:
             $this->type = "";
             break;
             // ends up as a \0 character.
         // ends up as a \0 character.
         case ezcArchiveEntry::IS_LINK:
             $this->type = 1;
             break;
         case ezcArchiveEntry::IS_SYMBOLIC_LINK:
             $this->type = 2;
             break;
         case ezcArchiveEntry::IS_DIRECTORY:
             $this->type = 5;
             break;
             // Devices, etc are set to \0.
         // Devices, etc are set to \0.
         default:
             $this->type = "";
             break;
             // ends up as a \0 character.
     }
     $length = strlen($this->fileName);
     if ($entry->getType() == ezcArchiveEntry::IS_DIRECTORY) {
         // Make sure that the filename ends with a slash.
         if ($this->fileName[$length - 1] != "/") {
             $this->fileName .= "/";
         }
     } else {
         if ($this->fileName[$length - 1] == "/") {
             $this->fileName = substr($header->fileName, 0, -1);
             // Remove last character.
         }
     }
 }