Phar::compressAllFilesBZIP2
(PHP >= 5.3.0, PECL phar >= 1.0.0)
Phar::compressAllFilesBZIP2 — Compresses all files in the current Phar archive using Bzip2 compression
Description
Note:
This method has been removed from the phar extension as of version 2.0.0. Alternative implementations are available using Phar::compress(), Phar::decompress(), Phar::compressFiles() and Phar::decompressFiles().
Note:
This method requires the php.ini setting phar.readonly to be set to 0 in order to work for Phar objects. Otherwise, a PharException will be thrown.
This method compresses all files in the Phar archive using bzip2 compression. The bzip2 extension must be enabled to take advantage of this feature. In addition, if any files are already compressed using gzip compression, the zlib extension must be enabled in order to decompress the files prior to re-compressing with bzip2 compression. As with all functionality that modifies the contents of a phar, the phar.readonly INI variable must be off in order to succeed.
Return Values
Returns TRUE
on success or FALSE
on failure.
Errors/Exceptions
Throws BadMethodCallException if the phar.readonly INI variable is on, the bzip2 extension is not available, or if any files are compressed using gzip compression and the zlib extension is not enabled.
Examples
Example #1 A Phar::compressAllFilesBZIP2() example
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressedBZIP2());
var_dump($file->isCompressedGZ());
}
$p->compressAllFilesBZIP2();
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressedBZIP2());
var_dump($file->isCompressedGZ());
}
?>
The above example will output:
string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) string(10) "myfile.txt" bool(true) bool(true) bool(false) string(11) "myfile2.txt" bool(true) bool(true) bool(false)
See Also
- PharFileInfo::getCompressedSize() - Returns the actual size of the file (with compression) inside the Phar archive
- PharFileInfo::isCompressedBZIP2() - Returns whether the entry is compressed using bzip2
- PharFileInfo::isCompressed() - Returns whether the entry is compressed
- PharFileInfo::isCompressedGZ() - Returns whether the entry is compressed using gz
- PharFileInfo::setCompressedBZIP2() - Compresses the current Phar entry within the phar using Bzip2 compression
- PharFileInfo::setUncompressed() - Uncompresses the current Phar entry within the phar, if it is compressed
- PharFileInfo::setCompressedGZ() - Compresses the current Phar entry within the phar using gz compression
- Phar::canCompress() - Returns whether phar extension supports compression using either zlib or bzip2
- Phar::isCompressed() - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
- Phar::compressAllFilesGZ() - Compresses all files in the current Phar archive using Gzip compression
- Phar::getSupportedCompression() - Return array of supported compression algorithms
- Phar::uncompressAllFiles() - Uncompresses all files in the current Phar archive
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для сжатия и архивации
- Phar
- Функция Phar::addEmptyDir() - Add an empty directory to the phar archive
- Функция Phar::addFile() - Add a file from the filesystem to the phar archive
- Функция Phar::addFromString() - Add a file from the filesystem to the phar archive
- Функция Phar::apiVersion() - Returns the api version
- Функция Phar::buildFromDirectory() - Construct a phar archive from the files within a directory.
- Функция Phar::buildFromIterator() - Construct a phar archive from an iterator.
- Функция Phar::canCompress() - Returns whether phar extension supports compression using either zlib or bzip2
- Функция Phar::canWrite() - Returns whether phar extension supports writing and creating phars
- Функция Phar::compress() - Compresses the entire Phar archive using Gzip or Bzip2 compression
- Функция Phar::compressAllFilesBZIP2() - Compresses all files in the current Phar archive using Bzip2 compression
- Функция Phar::compressAllFilesGZ() - Compresses all files in the current Phar archive using Gzip compression
- Функция Phar::compressFiles() - Compresses all files in the current Phar archive
- Функция Phar::__construct() - Construct a Phar archive object
- Функция Phar::convertToData() - Convert a phar archive to a non-executable tar or zip file
- Функция Phar::convertToExecutable() - Convert a phar archive to another executable phar archive file format
- Функция Phar::copy() - Copy a file internal to the phar archive to another new file within the phar
- Функция Phar::count() - Returns the number of entries (files) in the Phar archive
- Функция Phar::createDefaultStub() - Create a phar-file format specific stub
- Функция Phar::decompress() - Decompresses the entire Phar archive
- Функция Phar::decompressFiles() - Decompresses all files in the current Phar archive
- Функция Phar::delMetadata() - Deletes the global metadata of the phar
- Функция Phar::delete() - Delete a file within a phar archive
- Функция Phar::extractTo() - Extract the contents of a phar archive to a directory
- Функция Phar::getMetadata() - Returns phar archive meta-data
- Функция Phar::getModified() - Return whether phar was modified
- Функция Phar::getSignature() - Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
- Функция Phar::getStub() - Return the PHP loader or bootstrap stub of a Phar archive
- Функция Phar::getSupportedCompression() - Return array of supported compression algorithms
- Функция Phar::getSupportedSignatures() - Return array of supported signature types
- Функция Phar::getVersion() - Return version info of Phar archive
- Функция Phar::hasMetadata() - Returns whether phar has global meta-data
- Функция Phar::interceptFileFuncs() - instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions
- Функция Phar::isBuffering() - Used to determine whether Phar write operations are being buffered, or are flushing directly to disk
- Функция Phar::isCompressed() - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
- Функция Phar::isFileFormat() - Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter
- Функция Phar::isValidPharFilename() - Returns whether the given filename is a valid phar filename
- Функция Phar::isWritable() - Returns true if the phar archive can be modified
- Функция Phar::loadPhar() - Loads any phar archive with an alias
- Функция Phar::mapPhar() - Reads the currently executed file (a phar) and registers its manifest
- Функция Phar::mount() - Mount an external path or file to a virtual location within the phar archive
- Функция Phar::mungServer() - Defines a list of up to 4 $_SERVER variables that should be modified for execution
- Функция Phar::offsetExists() - determines whether a file exists in the phar
- Функция Phar::offsetGet() - Gets a PharFileInfo object for a specific file
- Функция Phar::offsetSet() - set the contents of an internal file to those of an external file
- Функция Phar::offsetUnset() - remove a file from a phar
- Функция Phar::running() - Returns the full path on disk or full phar URL to the currently executing Phar archive
- Функция Phar::setAlias() - Set the alias for the Phar archive
- Функция Phar::setDefaultStub() - Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader
- Функция Phar::setMetadata() - Sets phar archive meta-data
- Функция Phar::setSignatureAlgorithm() - set the signature algorithm for a phar and apply it.
- Функция Phar::setStub() - Used to set the PHP loader or bootstrap stub of a Phar archive
- Функция Phar::startBuffering() - Start buffering Phar write operations, do not modify the Phar object on disk
- Функция Phar::stopBuffering() - Stop buffering write requests to the Phar archive, and save changes to disk
- Функция Phar::uncompressAllFiles() - Uncompresses all files in the current Phar archive
- Функция Phar::unlinkArchive() - Completely remove a phar archive from disk and from memory
- Функция Phar::webPhar() - mapPhar for web-based phars. front controller for web applications
Коментарии
404 Not Found