Releases: wapmorgan/UnifiedArchive
1.2.0
- Deprecate few functions:
- Formats::checkFormatSupportAbility() marked deprecated, use
can()
instead. - UnifiedArchive: addFile() and addDirectory() marked deprecated, use
add()
instead.
- Formats::checkFormatSupportAbility() marked deprecated, use
- Changed behaviour:
- UnifiedArchive: add() and create() changed
fileOrFiles
handling: if passed string, then file/directory will be archived with full its original name (as opposed to relative name before). - Formats: detectArchiveFormat() and getFormatMimeType() returns null instead of false in case of failed type detection.
- UnifiedArchive::getMimeType() returns null instead of false.
- UnifiedArchive: add() and create() changed
- New:
- Improved
test()
functionality - returns list of mismatched hashes.
- Improved
1.1.10: Fixed TarByPear driver
Fixed pure tar driver.
1.1.9: Fix for format detection of archive by content
Fixed detection of archive format by it's content
1.1.8: Creation in string, bugs fixes, new pure driver
Fixed:
- Fixed opening an archive with password (#37)
- Fixed
UnifiedArchive->getComment()
now returns null when comment is not supported by driver (#39) - Fixed
UnifiedArchive->getFileData()->modificationTime
is integer timestamp now in case of NelexaZip driver instead of DateTimeImmutable (#38) - Fixed
PharData::create
for zip-archives
Deprecations:
- Renamed methods of
UnifiedArchive
:getFileNames
=>getFiles
extractFiles
=>extract
addFiles
=>add
deleteFiles
=>delete
archiveFiles
=>archive
canOpenArchive
=>canOpen
- Old methods are marked as deprecated and will be deleted in future releases.
- Marked as deprecated:
UnifiedArchive::detectArchiveType
- useFormats::detectArchiveFormat
insteadUnifiedArchive::archiveDirectory
/archiveFile
- useUnifiedArchive::archive
insteadUnifiedArchive::canCreateType
-Formats::canCreate
New functions:
- Added method to get file extension for format:
Formats::getFormatExtension($archiveFormat)
- Added method to get info about ready to archive files:
UnifiedArchive->prepareForArchiving($fileOrFiles, $archiveName = null)
- Added method to create archive in memory:
UnifiedArchive::createInString()
andBasicDriver::CREATE_IN_STRING
ability constant - Added new pure driver for Zip/Tar(gz/bz2) - SplitbrainPhpArchive.
1.1.7: BC
open
does not throw an Exception, it returns null- returned deleted methods in UnifiedArchive:
canOpenArchive
,canOpenType
,canCreateType
,getArchiveType
,detectArchiveType
,getFileResource
,getArchiveFormat
,isFileExists
,getArchiveSize
,countCompressedFilesSize
,countUncompressedFilesSize
.
1.1.6: Driver abilities + informative commands + NelexaZip driver
BC-breaking changes:
-
Changed signature:
UnifiedArchive::open($filename, string|null $password = null)
=>UnifiedArchive::open($filename, array $abilities = [], string|null $password = null)
. Right now if second argument is string, it will be treated as password (for BC-compatability). -
open
throws an Exception when format is not recognized or there's no driver that support requested abilities. -
addFiles
/deleteFiles
/getComment
/setComment
throws an Exception when driver does not support this ability. -
Deleted methods in UnifiedArchive:
canOpenArchive
,canOpenType
,canCreateType
,getArchiveType
,detectArchiveType
,getFileResource
,getArchiveFormat
,isFileExists
,getArchiveSize
,countCompressedFilesSize
,countUncompressedFilesSize
.
New features:
- Added passing needed abilities to UnifiedArchive::open() to select a better driver:
use \wapmorgan\UnifiedArchive\Drivers\BasicDriver; # opens an array with driver, that supports content streaming and appending $archive = \wapmorgan\UnifiedArchive\UnifiedArchive::open('archive.7z', [BasicDriver::STREAM_CONTENT, BasicDriver::APPEND]); # if not specified, uses OPEN or OPEN_ENCRYPTED check, if password passed
- Added
UnifiedArchive::test($files = [])
(andcam files:test
command) to test archive contents (compare actual control sum with stored crc32). - More informative output in commands:
system:drivers
,system:formats
,system:format
, added commandfiles:test
. - Added driver abilities to select better driver.
Driver changes:
- Added
NelexaZip
pure-PHP driver. - Added
Iso
driver extraction ability. - Added commenting-ability for
SevenZip
driver (viadescript.ion
file in archive).
1.1.5: A lot of fixes and new CLI utility
New features:
- Reimplemented
cam
(console utility) - now it's on symfony/console and supports all features and more functions (folders, types) of UA. - Added more detailed installation instructions (
./vendor/bin/cam system:drivers
) of specific drivers: AlchemyZippy, Cab, Iso, Lzma, Rar, SevenZip, TarByPear. - Added ability to track progress of archive creation - new argument
?callable $fileProgressCallable
ofUnifiedArchive::archiveFiles()
. - Added ability to pass few directories to be placed in one in-archive directory in archiving/appending (
addFiles()
/archiveFiles()
)[ '' => ['./folder1', './folder2'], 'README.md' => './subfolder/README.md' ] # Archive will have all folder1, folder2 contents in the root and README.md
Fixed:
- Fixed
extract()
andlistContent()
and their result of PclZip interface (UnifiedArchive::getPclZipInterface()
) to correspond to original library (object => array). - Added tests on archiving, extraction and for PclZip-interface.
Format changes:
- Fixed counting of extracted files when extracting the whole archive in
TarByPear, TarByPhar, Zip
. - Fixed calculation archive entry compressed size (approximately) and modification time, implemented entry content streaming in
TarByPhar
.
1.1.4: Disable Rar support in SevenZip driver
Disabled rar
for SevenZip driver.
1.1.3: Fixes, password, iteration
Changed format of $files
in archiveFiles()
and addFiles()
[
'/var/www/log.txt', // will be "/var/www/log.txt"
'log2.txt' => '/var/www/log2.txt', // will be "/log2.txt"
'/var/www/site', // will be "/var/www/site"
'site2' => '/var/www/site2', // will be "/site2"
]
Old format also works, but there can be a bad case. If you have /var/www/log2.txt and log2.txt (in current directory) and pass following:
[
'/var/www/log2.txt' => 'log2.txt',
]
it will archive log2.txt as /var/www/log2.txt in an archive (new behaviour).
New features:
- Added
Formats::canStream()
to check if an archive files can be streamed. - Added ability to create archives, encrypted with password (only zip (
Zip
,SevenZip
) and 7z (SevenZip
)) - added nullable$password
argument to:UnifiedArchive::archiveFiles($fileOrFiles, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
UnifiedArchive::archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
UnifiedArchive::archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null)
- Added
UnifiedArchive->getMimeType()
to get mime type of archive. - Added
UnifiedArchive->getComment()
to get comment of an archive. Available only inZip
andRar
drivers, others returnnull
. - Added
UnifiedArchive->setComment(?string $comment)
to set comment. Available only inZip
. - Added filter in
UnifiedArcihve->getFileNames()
. If works asfnmatch()
does. - Added ability to iterate over archive and access files data as array:
$a = \wapmorgan\UnifiedArchive\UnifiedArchive::open('tests/archives/fixtures.7z');
foreach ($a as $file => $data) {
echo $file.PHP_EOL;
}
$file_data = $a['filename'];
Fixed:
- Fixed
SevenZip
driver: disabled tar.gz, tar.bzip2 support as it isn't supported properly and described which formats driver can create, append, modify and encrypt.
Methods renamed (old exist, but marked as deprecated):
UnifiedArchive->getArchiveFormat
->UnifiedArchive->getFormat
.UnifiedArchive->getArchiveSize
->UnifiedArchive->getSize
.UnifiedArchive->countCompressedFilesSize
->UnifiedArchive->getCompressedSize
.UnifiedArchive->countUncompressedFilesSize
->UnifiedArchive->getOriginalSize
.UnifiedArchive->getFileResource
->UnifiedArchive->getFileStream
.UnifiedArchive->isFileExists
->UnifiedArchive->hasFile
.
1.1.2: Fixed xz-format
Fixed calculation of tar's uncompressed size opened via TarByPear
driver.
Fixed working with tar.xz archives.