Skip to content

Releases: wapmorgan/UnifiedArchive

1.2.0

30 Jun 15:53
5f02ad0
Compare
Choose a tag to compare
  • Deprecate few functions:
    • Formats::checkFormatSupportAbility() marked deprecated, use can() instead.
    • UnifiedArchive: addFile() and addDirectory() marked deprecated, use add() instead.
  • 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.
  • New:
    • Improved test() functionality - returns list of mismatched hashes.

1.1.10: Fixed TarByPear driver

17 Jan 00:16
Compare
Choose a tag to compare

Fixed pure tar driver.

1.1.9: Fix for format detection of archive by content

17 Jan 00:09
Compare
Choose a tag to compare

Fixed detection of archive format by it's content

1.1.8: Creation in string, bugs fixes, new pure driver

20 Nov 12:51
Compare
Choose a tag to compare

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 - use Formats::detectArchiveFormat instead
    • UnifiedArchive::archiveDirectory/archiveFile - use UnifiedArchive::archive instead
    • UnifiedArchive::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() and BasicDriver::CREATE_IN_STRING ability constant
  • Added new pure driver for Zip/Tar(gz/bz2) - SplitbrainPhpArchive.

1.1.7: BC

30 Jul 23:27
Compare
Choose a tag to compare
  • 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

30 Jul 22:39
Compare
Choose a tag to compare

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 = []) (and cam 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 command files: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 (via descript.ion file in archive).

1.1.5: A lot of fixes and new CLI utility

28 Jun 12:46
Compare
Choose a tag to compare

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 of UnifiedArchive::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() and listContent() 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

21 Dec 19:25
233e78b
Compare
Choose a tag to compare

Disabled rar for SevenZip driver.

1.1.3: Fixes, password, iteration

02 May 20:28
Compare
Choose a tag to compare

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 in Zip and Rar drivers, others return null.
  • Added UnifiedArchive->setComment(?string $comment) to set comment. Available only in Zip.
  • Added filter in UnifiedArcihve->getFileNames(). If works as fnmatch() 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

01 Mar 00:38
Compare
Choose a tag to compare

Fixed calculation of tar's uncompressed size opened via TarByPear driver.
Fixed working with tar.xz archives.