Giter VIP home page Giter VIP logo

archive7z's People

Contributors

gemorroj avatar silverqx avatar wapmorgan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

archive7z's Issues

To do the equivalent of / and \ in file paths

To unify the directory separators for different file systems.
For example:

$obj = new Archive7z('test.7z');
$obj->getEntry('test/test.txt'); // must be equivalent
$obj->getEntry('test\\test.txt'); // must be equivalent

Extracting tar.gz/tar.bz2 in one-step

Feature request: treat tar.gz/tgz archive as a tar archive with compression, not as an archive compressed to gz file.

Right now it treats UnifiedArchive.tar.gz like

                                          File name | Size | Date              
--------------------------------------------------------------------------------
UnifiedArchive.tar                                  | 0.0g |  01 Jan 1970, 3:01
--------------------------------------------------------------------------------
                                    Total 1 file(s) | 0.0g | 0.0g

My propose is to handle this case.
CLI for this is 7z x -so ../UnifiedArchive.tar.gz | 7z l -si -ttar.

Detailed information:
https://superuser.com/questions/80019/how-can-i-unzip-a-tar-gz-in-one-step-using-7-zip

getContent fails

Execution of example fails on this line:
echo $obj->getContent('test.txt');

Reading previously divided archives

Hello and thank you for this cool tool!

I have a problem with reading contents of divided into parts archives. The command is failing, however showing some contents.

File names are stored as hash values.

Is there a simple solution to, maybe, ignore or fix this type of error without archive modification? The process is failing before I can catch it in an easy way.

Example output:

The command "'/usr/bin/7z' 'l' '/home/www/var/files/DB0/hash/f8/01/7c78e011b8ca53015b' '-slt' '-y' '-p '" failed.
Exit Code: 2(Misuse of shellbuiltins)
Working directory: /home/www

Output:                                                                                                                                                                        
================                                                                                                                                                               
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov :2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (906E9),ASM,AES-NI)

Scanning the drive for archives:
1 file, 220200960 bytes (210 MiB)

Listing archive: /home/www/var/files/DB0/hash/f8/01/7c78e011b8ca53015b
--                                                                                                                                                                             
Path = /home/www/var/files/DB0/hash/f8/01/7c78e011b8ca53015b
Type = Rar
ERROR = Missing volume : f801b604de805be59b0b7d61288e3811ef31d6e9e091777c78e011b8ca53015b.r00
Physical Size = 220200960
Characteristics = Volume NewVolName FirstVolume VolCRC
Solid = -
Blocks = 1
Multivolume = +
Volume Index = 0
Volumes = 1
 ----------                                                                                                                                                                     
Path = setup_Full.exe
Folder = -
Size = 438531863
Packed Size = 220200861
Modified = 2008-09-09 12:52:34
Created =
Accessed =
Attributes = A
Encrypted = -
Solid = -
Commented = -
Split Before = -
Split After = +
CRC = 1B0C199D
Host OS = Win32
Method = m0:22
Version = 20

Errors: 1

Question marks in Cyrillic file names

Hi all!

I have a problem with the Archive7z class. I made a function

public function unzip(string $pathToSource): DirectoryIterator
   {
       ...

      $obj = new Archive7z($pathToSource);
      $obj->setOutputDirectory($pathToDestination);
      $obj->extract();

      return new DirectoryIterator($pathToDestination);
   }

which returns a DirectoryIterator with the directory to unpack
files.

Next, I collect information about the unpacked files:

 $iterator = $this->zipper->unzip($zipFile->getRealPath());
 foreach ($iterator as $unzippedFile) {
     if (!in_array($unzippedFile->getFilename(), ['.', '..'])) {
         $encoding = mb_detect_encoding($unzippedFile->getFilename()); // ASCII
         $fileName = $unzippedFile->getFilename(); // 12_1_?????.txt
     }
  }

And on my server, the encoding is defined as ASCII, and in the file names instead of Cyrillic letters
question marks.

In the local environment(Docker), everything is displayed normally. mb_detect_encoding($unzippedFile->getFilename())
returns UTF-8 and the file names are correct.

I also tried to reproduce this error in docker and I managed to do it using the link https://zalinux.ru/?p=5740.
That is, I commented out the en_US.UTF-8 UTF-8 encoding in the PHP container in the /etc/locale.gen file and ran the command
locale-gen. After that, I only had ru_RU.UTF-8 UTF-8 encoding left. And after that the encoding of the unpacked files
also began to be defined as ASCII, not UTF-8, and question marks began to appear instead of Cyrillic characters ?

If we return the en_US.UTF-8 UTF-8 encoding in the container and execute locale-gen, then again everything works fine. Tell,
please, what can I do so that when unpacking files, Cyrillic characters are displayed in the file names, not signs
questions. How to make files unpacked in UTF-8 encoding and not ASCII?

Got $entry->getPackedSize() only for first file

Hi. Tried library and faced this issue.

                $this->seven_zip = new \Archive7z\Archive7z($filename);
                foreach ($this->seven_zip->getEntries() as $entry) {
                    var_dump($entry->getPackedSize());
                }

It returns only first file value. Also, that's value for all array, not for specified file.

string(5) "10584"
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""

physicalSize missing from gzip files

getinfo() on gzip not returning much data, specially physicalSize

[path:Archive7z\Info:private] => /test.tar.gz
[type:Archive7z\Info:private] => gzip
[physicalSize:Archive7z\Info:private] =>
[headersSize:Archive7z\Info:private] => 25
[method:Archive7z\Info:private] =>
[solid:Archive7z\Info:private] =>
[blocks:Archive7z\Info:private] =>
[codePage:Archive7z\Info:private] =>

Hello, what is the problem causing this error?

Hello, what is the problem causing this error?

Binary of 7-zip is not available
root@:~# ls -l /usr/bin/7z
-rwxr-xr-x 1 www root 39 Aug 15  2020 /usr/bin/7z
root@:~# 7z -version

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU AMD EPYC 7601 32-Core Processor                 (800F12),ASM,AES-NI)

Debian11.6๏ผŒ php7.4.33

Need help with installation

Hi. Sorry for bothering you all, but I need some help with installing Archive7z.

My website runs on a 3rd party web hosting service. I uploaded all the files and it seems to be working fine except for one problem: It can't find the 7zip executable.

In Archive7zTrait.php, I changed the path specified in $binary7zNix, because there would be some problems with directory permissions, so I now just need the executable to upload. But I can't find a way to get it. I'm using Windows on my PC and I don't have access to the command line of the Linux server, that is used by the hosting service.

Could somebody please send me the executable, so I can upload it? Or if you think that this won't be enough, can you help me in any other way?

Add inArchivePath in addEntry

Now addEntry($file, $includeSubFiles = false, $storePath = false) does not support setting name of file in archive. Do you plan to add functionality to specify in-archive path of file when adding it?

Failed on macos

\Archive7z\Archive7z::getAutoCli on OSX returns cliWindows, because PHP_OS contains 'Darwin'
So, I think it will be good to fix it and add support for 7z on Mac (e.g. keka archiver https://github.com/aonez/Keka)

getCrc() fails sometimes

For few archive types, CRC is not parsed from 7z l, so it is empty, so it fails with Exception

Fatal error: Uncaught TypeError: Archive7z\Entry::getCrc(): Return value must be of type string, null returned in /app/vendor/gemorroj/archive7z/src/Entry.php:240
Stack trace:
#0 /app/src/Drivers/SevenZip.php(217): Archive7z\Entry->getCrc()
#1 /app/src/UnifiedArchive.php(284): wapmorgan\UnifiedArchive\Drivers\SevenZip->getFileData('doc')
#2 /app/src/Commands/TableCommand.php(66): wapmorgan\UnifiedArchive\UnifiedArchive->getFileData('doc')

I found that crc is present for ZIP/TAR.GZ, and not present for TAR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.