cvs: phpdoc /en/reference/phar book.xml fileformat.xml using.xml /en/reference/phar/Phar buildFromDirectory.xml buildFromIterator.xml canCompress.xml
compress.xml compressAllFilesBZIP2.xml compressAllFilesGZ.xml compressFiles.xml convertToData.xml convertToExecutable.xml convertToPhar.xml
convertToTar.xml convertToZip.xml decompress.xml decompressFiles.xml getSupportedCompression.xml isCompressed.xml isPhar.xml isTar.xml isZip.xml
uncompressAllFiles.xml /en/reference/phar/PharData compress.xml compressAllFilesBZIP2.xml compressAllFilesGZ.xml compressFiles.xml convertToData.xml
convertToExecutable.xml convertToPhar.xml convertToTar.xml convertToZip.xml decompress.xml decompressFiles.xml offsetUnset.xml setMetadata.xml
setSignatureAlgorithm.xml /en/reference/phar/PharFileInfo chmod.xml compress.xml decompress.xml delMetadata.xml getCompressedSize.xml
isCompressed.xml isCompressedBZIP2.xml isCompressedGZ.xml setCompressedBZIP2.xml setCompressedGZ.xml setMetadata.xml! setUncompressed.xml
| From: | Greg Beaver | Date: | Thu, 01 May 2008 03:28:08 +0000 |
| Subject: | cvs: phpdoc /en/reference/phar book.xml fileformat.xml using.xml /en/reference/phar/Phar buildFromDirectory.xml buildFromIterator.xml canCompress.xml compress.xml compressAllFilesBZIP2.xml compressAllFilesGZ.xml compressFiles.xml convertToData.xml convertToExecutable.xml convertToPhar.xml convertToTar.xml convertToZip.xml decompress.xml decompressFiles.xml getSupportedCompression.xml isCompressed.xml isPhar.xml isTar.xml isZip.xml uncompressAllFiles.xml /en/reference/phar/PharData compress.xml compressAllFilesBZIP2.xml compressAllFilesGZ.xml compressFiles.xml convertToData.xml convertToExecutable.xml convertToPhar.xml convertToTar.xml convertToZip.xml decompress.xml decompressFiles.xml offsetUnset.xml setMetadata.xml setSignatureAlgorithm.xml /en/reference/phar/PharFileInfo chmod.xml compress.xml decompress.xml delMetadata.xml getCompressedSize.xml isCompressed.xml isCompressedBZIP2.xml isCompressedGZ.xml setCompressedBZIP2.xml setCompressedGZ.xml setMetadata.xml! setUncompressed.xml |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-1578@lists.php.net to get a copy of this message | ||
cellog Thu May 1 03:28:08 2008 UTC
Added files:
/phpdoc/en/reference/phar/Phar buildFromDirectory.xml
compressFiles.xml convertToData.xml
convertToExecutable.xml
decompress.xml decompressFiles.xml
/phpdoc/en/reference/phar/PharData compress.xml compressFiles.xml
convertToData.xml
convertToExecutable.xml
decompress.xml
decompressFiles.xml
offsetUnset.xml setMetadata.xml
setSignatureAlgorithm.xml
/phpdoc/en/reference/phar/PharFileInfo compress.xml decompress.xml
Removed files:
/phpdoc/en/reference/phar/Phar convertToPhar.xml convertToTar.xml
convertToZip.xml
/phpdoc/en/reference/phar/PharData compressAllFilesBZIP2.xml
compressAllFilesGZ.xml
convertToPhar.xml
convertToTar.xml
convertToZip.xml
Modified files:
/phpdoc/en/reference/phar book.xml fileformat.xml using.xml
/phpdoc/en/reference/phar/Phar buildFromIterator.xml
canCompress.xml compress.xml
compressAllFilesBZIP2.xml
compressAllFilesGZ.xml
getSupportedCompression.xml
isCompressed.xml isPhar.xml
isTar.xml isZip.xml
uncompressAllFiles.xml
/phpdoc/en/reference/phar/PharFileInfo chmod.xml delMetadata.xml
getCompressedSize.xml
isCompressed.xml
isCompressedBZIP2.xml
isCompressedGZ.xml
setCompressedBZIP2.xml
setCompressedGZ.xml
setMetadata.xml
setUncompressed.xml
Log:
continue doc updating to current API
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/book.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/phar/book.xml diff -u phpdoc/en/reference/phar/book.xml:1.5 phpdoc/en/reference/phar/book.xml:1.6 --- phpdoc/en/reference/phar/book.xml:1.5 Tue Mar 25 15:36:13 2008 +++ phpdoc/en/reference/phar/book.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- Purpose: compression --> <!-- Membership: pecl --> @@ -18,7 +18,7 @@ PDO provides a unified interface for accessing different databases. Unlike PDO, which cannot convert between different databases, Phar also can convert between tar, zip and phar file formats with a single line of code. see - <function>Phar::convertToTar</function> for one example. + <function>Phar::convertToExecutable</function> for one example. </para> <para> What is phar? Phar archives are best characterized as a convenient way to group http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/fileformat.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/phar/fileformat.xml diff -u phpdoc/en/reference/phar/fileformat.xml:1.10 phpdoc/en/reference/phar/fileformat.xml:1.11 --- phpdoc/en/reference/phar/fileformat.xml:1.10 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/fileformat.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <chapter xml:id="phar.fileformat" xmlns="http://docbook.org/ns/docbook"> <title>What makes a phar a phar and not a tar or a zip?</title> <section xml:id="phar.fileformat.ingredients" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -203,8 +203,7 @@ </para> <para> To compress an entire archive, use <function>Phar::compress</function>. - To decompress an entire archive, use <function>Phar::compress</function> with - the <literal>Phar::NONE</literal> constant. + To decompress an entire archive, use <function>Phar::decompress</function>. </para> </section> <section xml:id="phar.fileformat.zip" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/using.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/phar/using.xml diff -u phpdoc/en/reference/phar/using.xml:1.11 phpdoc/en/reference/phar/using.xml:1.12 --- phpdoc/en/reference/phar/using.xml:1.11 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/using.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <chapter xml:id="phar.using" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Using Phar Archives</title> @@ -84,7 +84,7 @@ if (Phar::canWrite()) { $p = new Phar('newphar.tar.phar', 0, 'newphar.tar.phar'); // make this a tar-based phar archive, compressed with gzip compression (.tar.gz) - $p = $p->convertToTar()->compress(Phar::GZ); + $p = $p->convertToExecutable(Phar::TAR, Phar::GZ); // create transaction - nothing is written to newphar.phar // until stopBuffering() is called, although temporary storage is needed @@ -99,7 +99,7 @@ $p['data/hugefile.dat'] = $fp; if (Phar::canCompress(Phar::GZ)) { - $p['data/hugefile.dat']->setCompressedGZ(); + $p['data/hugefile.dat']->compress(Phar::GZ); } $p['images/wow.jpg'] = file_get_contents('images/wow.jpg'); @@ -138,7 +138,7 @@ </para> <para> <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ <?php @unlink('phpMyAdmin.phar.tar.php'); @@ -263,7 +263,7 @@ <para> An empty Phar archive will be created at <literal>/path/to/myphar.phar</literal>, or if <literal>/path/to/myphar.phar</literal> already exists, it will be opened - again. The literal <literal>myphar.phar</literal> deomnstrates the concept of an alias + again. The literal <literal>myphar.phar</literal> demonstrates the concept of an alias that can be used to reference <literal>/path/to/myphar.phar</literal> in URLs as in: </para> <para> @@ -298,7 +298,12 @@ (<literal>phar://myphar.phar/file.php</literal>), or overwrites an existing file within <literal>myphar.phar</literal>. <literal>$v</literal> can be either a string or an open file pointer, in which case the entire - contents of the file will be used to create the new file. + contents of the file will be used to create the new file. Note that + <literal>$p->addFromString('file.php', $v)</literal> is functionally + equivalent to the above. Also possible is to add the contents of a file + with <literal>$p->addFile('/path/to/file.php', 'file.php')</literal>. + Lastly, an empty directory can be created with + <literal>$p->addEmptyDir('empty')</literal>. </simpara> </listitem> <listitem> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromIterator.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/buildFromIterator.xml diff -u phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.2 phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.3 --- phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/buildFromIterator.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.buildfromiterator" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromIterator</refname> @@ -167,14 +167,15 @@ </para> </refsect1> -<!-- <refsect1 role="seealso"> + + <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> - <member><link linkend="phar.arrayaccess">Using array access with Phar</link></member> + <member><function>Phar::buildFromDirectory</function></member> </simplelist> </para> - </refsect1>--> + </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/canCompress.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/canCompress.xml diff -u phpdoc/en/reference/phar/Phar/canCompress.xml:1.2 phpdoc/en/reference/phar/Phar/canCompress.xml:1.3 --- phpdoc/en/reference/phar/Phar/canCompress.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/canCompress.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.cancompress"> <refnamediv> <refname>Phar::canCompress</refname> @@ -67,19 +67,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compress.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/phar/Phar/compress.xml diff -u phpdoc/en/reference/phar/Phar/compress.xml:1.4 phpdoc/en/reference/phar/Phar/compress.xml:1.5 --- phpdoc/en/reference/phar/Phar/compress.xml:1.4 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/Phar/compress.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compress"> <refnamediv> <refname>Phar::compress</refname> @@ -11,6 +11,7 @@ <methodsynopsis> <type>object</type><methodname>Phar::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; @@ -32,7 +33,8 @@ <para> In addition, this method automatically renames the archive, appending <literal>.gz</literal>, <literal>.bz2</literal> or removing the extension if passed <literal>Phar::NONE</literal> to - remove compression. + remove compression. Alternatively, a file extension may be specified with the second + parameter. </para> <para> A <classname>Phar</classname> object is returned. @@ -53,6 +55,18 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term><parameter>extension</parameter></term> + <listitem> + <para> + By default, the extension is <literal>.phar.gz</literal> + or <literal>.phar.bz2</literal> for compressing phar archives, and + <literal>.phar.tar.gz</literal> or <literal>.phar.tar.bz2</literal> for + compressing tar archives. For decompressing, the default file extensions + are <literal>.phar</literal> and <literal>.phar.tar</literal>. + </para> + </listitem> + </varlistentry> </variablelist> </para> @@ -95,18 +109,16 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml diff -u phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.2 phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.3 --- phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressallfilesbzip2"> <refnamediv> <refname>Phar::compressAllFilesBZIP2</refname> @@ -13,7 +13,8 @@ <type>bool</type><methodname>Phar::compressAllFilesBZIP2</methodname> <void/> </methodsynopsis> - &phar.write; + &phar.removed.pharcompress; + &phar.write; <para> This method compresses all files in the Phar archive using bzip2 compression. @@ -106,8 +107,6 @@ <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml diff -u phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.2 phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.3 --- phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressallfilesgz"> <refnamediv> <refname>Phar::compressAllFilesGZ</refname> @@ -12,7 +12,8 @@ <type>bool</type><methodname>Phar::compressAllFilesGZ</methodname> <void/> </methodsynopsis> - &phar.write; + &phar.removed.pharcompress; + &phar.write; <para> For tar-based phar archives, this method compresses the entire archive using @@ -111,8 +112,6 @@ <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/getSupportedCompression.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/getSupportedCompression.xml diff -u phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.2 phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.3 --- phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/getSupportedCompression.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.getsupportedcompression" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::getSupportedCompression</refname> @@ -38,19 +38,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>Phar::compress</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isCompressed.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/phar/Phar/isCompressed.xml diff -u phpdoc/en/reference/phar/Phar/isCompressed.xml:1.3 phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 --- phpdoc/en/reference/phar/Phar/isCompressed.xml:1.3 Wed Apr 9 10:58:08 2008 +++ phpdoc/en/reference/phar/Phar/isCompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="phar.iscompressed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isCompressed</refname> @@ -72,19 +72,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>Phar::decompress</function></member> + <member><function>Phar::compress</function></member> <member><function>Phar::canCompress</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isPhar.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isPhar.xml diff -u phpdoc/en/reference/phar/Phar/isPhar.xml:1.2 phpdoc/en/reference/phar/Phar/isPhar.xml:1.3 --- phpdoc/en/reference/phar/Phar/isPhar.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isPhar.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.isphar" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isPhar</refname> @@ -35,8 +35,8 @@ <simplelist> <member><function>Phar::isTar</function></member> <member><function>Phar::isZip</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::convertToZip</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isTar.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isTar.xml diff -u phpdoc/en/reference/phar/Phar/isTar.xml:1.2 phpdoc/en/reference/phar/Phar/isTar.xml:1.3 --- phpdoc/en/reference/phar/Phar/isTar.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isTar.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.istar" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isTar</refname> @@ -36,8 +36,8 @@ <simplelist> <member><function>Phar::isPhar</function></member> <member><function>Phar::isZip</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToZip</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isZip.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isZip.xml diff -u phpdoc/en/reference/phar/Phar/isZip.xml:1.2 phpdoc/en/reference/phar/Phar/isZip.xml:1.3 --- phpdoc/en/reference/phar/Phar/isZip.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isZip.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.iszip" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isZip</refname> @@ -35,8 +35,8 @@ <simplelist> <member><function>Phar::isPhar</function></member> <member><function>Phar::isTar</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml diff -u phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.2 phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.3 --- phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.uncompressallfiles"> <refnamediv> <refname>Phar::uncompressAllFiles</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>Phar::uncompressAllFiles</methodname> <void/> </methodsynopsis> + &phar.removed.pharcompress; &phar.write; @@ -112,8 +113,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/chmod.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/chmod.xml diff -u phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/chmod.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phargileinfo.chmod"> <refnamediv> <refname>PharFileInfo::chmod</refname> @@ -17,6 +17,11 @@ file permissions bit, as well as read-only bits. Writeable bits are ignored, and set at runtime based on the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable. + As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml diff -u phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phargileinfo.delmetadata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharFileInfo::delMetadata</refname> @@ -28,6 +28,11 @@ &reftitle.returnvalues; <para> Returns &true; if successful, &false; if the entry had no metadata. + As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml diff -u phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.getcompressedsize"> <refnamediv> <refname>PharFileInfo::getCompressedSize</refname> @@ -58,20 +58,16 @@ &reftitle.seealso; <para> <simplelist> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compress</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::decompressFiles</function></member> + <member><function>Phar::compressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressed"> <refnamediv> <refname>PharFileInfo::isCompressed</refname> @@ -64,19 +64,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>Phar::decompress</function></member> + <member><function>Phar::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::decompressFiles</function></member> + <member><function>Phar::compressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressedbzip2"> <refnamediv> <refname>PharFileInfo::isCompressedBZIP2</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::isCompressedBZIP2</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This returns whether a file is compressed within a Phar archive @@ -79,8 +80,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressedgz"> <refnamediv> <refname>PharFileInfo::isCompressedGZ</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::isCompressedGZ</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This returns whether a file is compressed within a Phar archive @@ -79,8 +80,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setcompressedbzip2"> <refnamediv> <refname>PharFileInfo::setCompressedBZIP2</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setCompressedBZIP2</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method compresses the file inside the Phar archive using bzip2 compression. @@ -80,8 +81,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setcompressedgz"> <refnamediv> <refname>PharFileInfo::setCompressedGZ</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setCompressedGZ</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method compresses the file inside the Phar archive using gzip compression. @@ -80,8 +81,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setmetadata"> <refnamediv> <refname>PharFileInfo::setMetaData</refname> @@ -19,10 +19,11 @@ archive if the data is large, or if there are many files containing meta-data. It is important to note that file permissions are natively supported inside a phar; it is possible to set them with the - <function>PharFileInfo::chmod</function> method. As with all - functionality that modifies the contents of a phar, the - <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be - off in order to succeed. + <function>PharFileInfo::chmod</function> method. As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> <para> Some possible uses for meta-data include passing a user/group that should be set http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setuncompressed"> <refnamediv> <refname>PharFileInfo::setUncompressed</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setUncompressed</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method decompresses the file inside the Phar archive. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromDirectory.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/buildFromDirectory.xml +++ phpdoc/en/reference/phar/Phar/buildFromDirectory.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromDirectory</refname> <refpurpose>Construct a phar archive from the files within a directory.</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::buildFromDirectory</methodname> <methodparam><type>string</type><parameter>base_dir</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>regex</parameter></methodparam> </methodsynopsis> &phar.write; <para> Populate a phar archive from a directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>Phar::buildFromIterator</function>. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>A <function>Phar::buildFromDirectory</function> example</title> <para> </para> <para> <programlisting role="php"> <![CDATA[ <?php // create with alias "project.phar" $phar = new Phar('project.phar', 0, 'project.phar'); // add all files in the project $phar->buildFromDirectory(dirname(__FILE__) . '/project'); $phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); $phar2 = new Phar('project2.phar', 0, 'project2.phar'); // add all files in the project, only include php files $phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); $phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); ?> ]]> </programlisting> </para> </example> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>base_dir</parameter></term> <listitem> <para> The full or relative path to the directory that contains all files to add to the archive. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>regex</parameter></term> <listitem> <para> An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> <function>Phar::buildFromDirectory</function> returns an associative array mapping internal path of file to the full path of the file on the filesystem. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to instantiate the internal directory iterators, or a <classname>PharException</classname> if there were errors saving the phar archive. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::buildFromIterator</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/compressFiles.xml +++ phpdoc/en/reference/phar/Phar/compressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressfiles"> <refnamediv> <refname>Phar::compressFiles</refname> <refpurpose>Compresses all files in the current Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::compressFiles</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> &phar.write; <para> For tar-based phar archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>Phar::compress</function> to compress an entire tar-based phar archive. </para> <para> For Zip-based and phar-based phar archives, this method compresses all files in the Phar archive using the specified compression. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::compressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?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->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/convertToData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/convertToData.xml +++ phpdoc/en/reference/phar/Phar/convertToData.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.converttodata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::convertToData</refname> <refpurpose>Convert a phar archive to a non-executable tar or zip file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>PharData</type><methodname>Phar::convertToData</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> This method is used to convert an executable phar archive to either a tar or zip file. To make the tar or zip non-executable, the phar stub and phar alias files are removed from the newly created archive. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname> if the archive is in phar file format. For archives in tar or zip file format, this method converts the archive to a non-executable archive. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>PharData</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::TAR</literal> or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that <literal>.phar</literal> cannot be used anywhere in the filename for a non-executable tar or zip archive. </para> <para> If converting to a tar-based phar archive, the default extensions are <literal>.tar</literal>, <literal>.tar.gz</literal>, and <literal>.tar.bz2</literal> depending on specified compression. For zip-based archives, the default extension is <literal>.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>PharData</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>Phar::startBuffering</function> and has not concluded with <function>Phar::stopBuffering</function>, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::convertToData</function> example</title> <para> Using Phar::convertToData(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new Phar('myphar.phar.tar'); // note that myphar.phar.tar is *not* unlinked // convert it to the non-executable tar file format // creates myphar.tar $tar = $tarphar->comvertToData(); // convert to non-executable zip format, creates myphar.zip $zip = $tarphar->convertToData(Phar::ZIP); // create myphar.tbz $tgz = $tarphar->convertToData(Phar::TAR, Phar::BZ2, '.tbz'); // creates myphar.phar.tgz $phar = $tarphar->convertToData(Phar::PHAR); // throws exception } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>PharData::convertToExecutable</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/convertToExecutable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/convertToExecutable.xml +++ phpdoc/en/reference/phar/Phar/convertToExecutable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.converttoexecutable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::convertToExecutable</refname> <refpurpose>Convert a phar archive to another executable phar archive file format</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>Phar</type><methodname>Phar::convertToExecutable</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is used to convert a phar archive to another file format. For instance, it can be used to create a tar-based executable phar archive from a zip-based executable phar archive, or from an executable phar archive in the phar file format. In addition, it can be used to apply whole-archive compression to a tar or phar-based archive. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>Phar</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::PHAR</literal>, <literal>Phar::TAR</literal>, or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that all zip- and tar-based phar archives must contain <literal>.phar</literal> in their file extension in order to be processed as a phar archive. </para> <para> If converting to a phar-based archive, the default extensions are <literal>.phar</literal>, <literal>.phar.gz</literal>, or <literal>.phar.bz2</literal> depending on the specified compression. For tar-based phar archives, the default extensions are <literal>.phar.tar</literal>, <literal>.phar.tar.gz</literal>, and <literal>.phar.tar.bz2</literal>. For zip-based phar archives, the default extension is <literal>.phar.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>Phar</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>Phar::startBuffering</function> and has not concluded with <function>Phar::stopBuffering</function>, an <classname>UnexpectedValueException</classname> if write support is disabled, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::convertToExecutable</function> example</title> <para> Using Phar::convertToExecutable(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new Phar('myphar.phar.tar'); // convert it to the phar file format // note that myphar.phar.tar is *not* unlinked $phar = $tarphar->convertToExecutable(Phar::PHAR); // creates myphar.phar $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); // creates myphar.phar.tgz $compressed = $phar->convertToExecutable(Phar::TAR, Phar::GZ, '.phar.tgz'); } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToExecutable</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/decompress.xml +++ phpdoc/en/reference/phar/Phar/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.decompress"> <refnamediv> <refname>Phar::decompress</refname> <refpurpose>Decompresses the entire Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>Phar::decompress</methodname> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> For tar-based and phar-based phar archives, this method decompresses the entire archive. </para> <para> For Zip-based phar archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to decompress an archive compressed with with gzip compression, and the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to decompress an archive compressed with bzip2 compression. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> <para> In addition, this method automatically changes the file extension of the archive, <literal>.phar</literal> by default for phar archives, or <literal>.phar.tar</literal> for tar-based phar archives. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>Phar</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> For decompressing, the default file extensions are <literal>.phar</literal> and <literal>.phar.tar</literal>. Use this parameter to specify another file extension. Be aware that all executable phar archives must contain <literal>.phar</literal> in their filename. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar.gz'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p3 = $p2->decompress(); // creates /path/to/my.phar ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/decompressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/decompressFiles.xml +++ phpdoc/en/reference/phar/Phar/decompressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.decompressfiles"> <refnamediv> <refname>Phar::decompressFiles</refname> <refpurpose>Decompresses all files in the current Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::decompressFiles</methodname> <void /> </methodsynopsis> &phar.write; <para> For tar-based phar archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>Phar::compress</function> to compress an entire tar-based phar archive. </para> <para> For Zip-based and phar-based phar archives, this method decompresses all files in the Phar archive. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature if any files are compressed using bzip2/zlib compression. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::decompressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->decompressFiles(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/compress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/compress.xml +++ phpdoc/en/reference/phar/PharData/compress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.compress"> <refnamediv> <refname>PharData::compress</refname> <refpurpose>Compresses the entire tar/zip archive using Gzip or Bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>PharData::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> <methodparam><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> For tar archives, this method compresses the entire archive using gzip compression or bzip2 compression. The resulting file can be processed with the gunzip command/bunzip command, or accessed directly and transparently with the Phar extension. </para> <para> For zip archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to compress with gzip compression, the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to compress with bzip2 compression. </para> <para> In addition, this method automatically renames the archive, appending <literal>.gz</literal>, <literal>.bz2</literal> or removing the extension if passed <literal>Phar::NONE</literal> to remove compression. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>PharData</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> By default, the extension is <literal>.tar.gz</literal> or <literal>.tar.bz2</literal> for compressing a tar, and <literal>.tar</literal> for decompressing. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::compress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.tar'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p1 = $p->compress(Phar::GZ); // copies to /path/to/my.phar.gz $p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.phar.bz2 $p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.phar already exists ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::compress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/compressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/compressFiles.xml +++ phpdoc/en/reference/phar/PharData/compressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.compressfiles"> <refnamediv> <refname>PharData::compressFiles</refname> <refpurpose>Compresses all files in the current tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::compressFiles</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> <para> For tar-based archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>PharData::compress</function> to compress an entire tar-based archive. </para> <para> For Zip-based archives, this method compresses all files in the archive using the specified compression. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::compressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?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->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compress</function></member> <member><function>PharData::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/convertToData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/convertToData.xml +++ phpdoc/en/reference/phar/PharData/convertToData.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.converttodata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::convertToData</refname> <refpurpose>Convert a phar archive to a non-executable tar or zip file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>PharData</type><methodname>PharData::convertToData</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> This method is used to convert a non-executable tar or zip archive to another non-executable format. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. This method should be used to convert a tar archive to zip format or vice-versa. Although it is possible to simply change the compression of a tar archive using this method, it is better to use the <function>PharData::compress</function> method for logical consistency. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>PharData</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::TAR</literal> or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that <literal>.phar</literal> cannot be used anywhere in the filename for a non-executable tar or zip archive. </para> <para> If converting to a tar-based phar archive, the default extensions are <literal>.tar</literal>, <literal>.tar.gz</literal>, and <literal>.tar.bz2</literal> depending on specified compression. For zip-based archives, the default extension is <literal>.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>PharData</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>PharData::startBuffering</function> and has not concluded with <function>PharData::stopBuffering</function>, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::convertToData</function> example</title> <para> Using PharData::convertToData(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new PharData('myphar.tar'); // note that myphar.tar is *not* unlinked // convert it to the non-executable tar file format // creates myphar.zip $zip = $tarphar->convertToData(Phar::ZIP); // create myphar.tbz $tgz = $zip->convertToData(Phar::TAR, Phar::BZ2, '.tbz'); // creates myphar.phar.tgz $phar = $tarphar->convertToData(Phar::PHAR); // throws exception } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToExecutable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/convertToExecutable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/convertToExecutable.xml +++ phpdoc/en/reference/phar/PharData/convertToExecutable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.converttoexecutable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::convertToExecutable</refname> <refpurpose>Convert a non-executable tar/zip archive to an executable phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>Phar</type><methodname>PharData::convertToExecutable</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is used to convert a non-executable tar or zip archive to an executable phar archive. Any of the three executable file formats (phar, tar or zip) can be used, and whole-archive compression can also be performed. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>Phar</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::PHAR</literal>, <literal>Phar::TAR</literal>, or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that all zip- and tar-based phar archives must contain <literal>.phar</literal> in their file extension in order to be processed as a phar archive. </para> <para> If converting to a phar-based archive, the default extensions are <literal>.phar</literal>, <literal>.phar.gz</literal>, or <literal>.phar.bz2</literal> depending on the specified compression. For tar-based phar archives, the default extensions are <literal>.phar.tar</literal>, <literal>.phar.tar.gz</literal>, and <literal>.phar.tar.bz2</literal>. For zip-based phar archives, the default extension is <literal>.phar.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>Phar</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>PharData::startBuffering</function> and has not concluded with <function>PharData::stopBuffering</function>, an <classname>UnexpectedValueException</classname> if write support is disabled, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::convertToExecutable</function> example</title> <para> Using PharData::convertToExecutable(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new PharData('myphar.tar'); // convert it to the phar file format // note that myphar.tar is *not* unlinked $phar = $tarphar->convertToExecutable(Phar::PHAR); // creates myphar.phar $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); // creates myphar.phar.tgz $compressed = $tarphar->convertToExecutable(Phar::TAR, Phar::GZ, '.phar.tgz'); } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/decompress.xml +++ phpdoc/en/reference/phar/PharData/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.decompress"> <refnamediv> <refname>PharData::decompress</refname> <refpurpose>Decompresses the entire Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>PharData::decompress</methodname> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> For tar-based archives, this method decompresses the entire archive. </para> <para> For Zip-based archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to decompress an archive compressed with with gzip compression, and the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to decompress an archive compressed with bzip2 compression. </para> <para> In addition, this method automatically renames the file extension of the archive, <literal>.tar</literal> by default. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>PharData</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> For decompressing, the default file extension is <literal>.phar.tar</literal>. Use this parameter to specify another file extension. Be aware that no non-executable archives cannot contain <literal>.phar</literal> in their filename. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.tar', 0, 'my.tar.gz'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p3 = $p2->decompress(); // creates /path/to/my.tar ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compressFiles</function></member> <member><function>PharData::decompressFiles</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/decompressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/decompressFiles.xml +++ phpdoc/en/reference/phar/PharData/decompressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.decompressfiles"> <refnamediv> <refname>PharData::decompressFiles</refname> <refpurpose>Decompresses all files in the current zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::decompressFiles</methodname> <void /> </methodsynopsis> &phar.write; <para> For tar-based archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>PharData::compress</function> to compress an entire tar-based archive. </para> <para> For Zip-based archives, this method decompresses all files in the archive. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature if any files are compressed using bzip2/zlib compression. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::decompressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.zip'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->decompressFiles(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::compressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compress</function></member> <member><function>PharData::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/offsetUnset.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/offsetUnset.xml +++ phpdoc/en/reference/phar/PharData/offsetUnset.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.offsetunset"> <refnamediv> <refname>PharData::offsetUnset</refname> <refpurpose>remove a file from a tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::offsetUnset</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the <interfacename>ArrayAccess</interfacename> interface allowing direct manipulation of the contents of a tar/zip archive using array access brackets. offsetUnset is used for deleting an existing file, and is called by the <function>unset</function> language construct. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> The filename (relative path) to modify in the tar/zip archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if there are any problems flushing changes made to the tar/zip archive to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::offsetUnset</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.zip'); try { // deletes file.txt from my.zip by calling offsetUnset unset($p['file.txt']); } catch (Exception $e) { echo 'Could not delete file.txt: ', $e; } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::offsetUnset</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setMetadata.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setMetadata.xml +++ phpdoc/en/reference/phar/PharData/setMetadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="phardata.setmetadata"> <refnamediv> <refname>Phar::setMetadata</refname> <refpurpose>Sets phar archive meta-data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::setMetadata</methodname> <methodparam><type>mixed</type><parameter>metadata</parameter></methodparam> </methodsynopsis> &phar.write; <para> <function>Phar::setMetadata</function> should be used to store customized data that describes something about the phar archive as a complete entity. <function>PharFileInfo::setMetadata</function> should be used for file-specific meta-data. Meta-data can slow down the performance of loading a phar archive if the data is large. </para> <para> Some possible uses for meta-data include specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like <link xlink:href="http://pear.php.net">PEAR</link>'s package.xml file. However, any useful data that describes the phar archive may be stored. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>metadata</parameter></term> <listitem> <para> Any PHP variable containing information to store that describes the phar archive </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::setMetadata</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file.php'] = '<?php echo "hello"'; $p->setMetadata(array('bootstrap' => 'file.php')); var_dump($p->getMetadata()); } catch (Exception $e) { echo 'Could not create and/or modify phar:', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(1) { ["bootstrap"]=> string(8) "file.php" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::getMetadata</function></member> <member><function>Phar::delMetadata</function></member> <member><function>Phar::hasMetadata</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml +++ phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.setsignaturealgorithm" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::setSignatureAlgorithm</refname> <refpurpose>set the signature algorithm for a phar and apply it. The</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::setSignatureAlgorithm</methodname> <methodparam><type>int</type><parameter>sigtype</parameter></methodparam> </methodsynopsis> &phar.write; <para> set the signature algorithm for a phar and apply it. The signature algorithm must be one of <literal>Phar::MD5</literal>, <literal>Phar::SHA1</literal>, <literal>Phar::SHA256</literal>, <literal>Phar::SHA512</literal>, or <literal>Phar::PGP</literal> (pgp not yet supported and falls back to SHA-1). </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>sigtype</parameter></term> <listitem> <para> One of <literal>Phar::MD5</literal>, <literal>Phar::SHA1</literal>, <literal>Phar::SHA256</literal>, <literal>Phar::SHA512</literal>, or <literal>Phar::PGP</literal> </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>UnexpectedValueException</classname> for many errors, <classname>BadMethodCallException</classname> if called for a zip- or a tar-based phar archive, and a <classname>PharException</classname> if any problems occur flushing changes to disk. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::getSupportedSignatures</function></member> <member><function>Phar::getSignature</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/compress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharFileInfo/compress.xml +++ phpdoc/en/reference/phar/PharFileInfo/compress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.compress"> <refnamediv> <refname>PharFileInfo::compress</refname> <refpurpose>Compresses the current Phar entry with either zlib or bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> <para> This method compresses the file inside the Phar archive using either bzip2 compression or zlib compression. The <link linkend="ref.bzip2">bzip2</link> or <link linkend="ref.zlib">zlib</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed, the respective extension must be enabled in order to decompress the file. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed if the file is within a <classname>Phar</classname> archive. Files within <classname>PharData</classname> archives do not have this restriction. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>/<link linkend="ref.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo::compress</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressed(Phar::BZ2)); $p['myfile.txt']->compress(Phar::BZ2); var_dump($file->isCompressed(Phar::BZ2)); } catch (Exception $e) { echo 'Create/modify operations on my.phar failed: ', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharFileInfo/decompress.xml +++ phpdoc/en/reference/phar/PharFileInfo/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.decompress"> <refnamediv> <refname>PharFileInfo::decompress</refname> <refpurpose>Decompresses the current Phar entry within the phar</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo::decompress</methodname> <void/> </methodsynopsis> <para> This method decompresses the file inside the Phar archive. Depending on how the file is compressed, the <link linkend="ref.bzip2">bzip2</link> or <link linkend="ref.zlib">zlib</link> extensions must be enabled to take advantage of this feature. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed if the file is within a <classname>Phar</classname> archive. Files within <classname>PharData</classname> archives do not have this restriction. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>/<link linkend="ref.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; $file->compress(Phar::GZ); var_dump($file->isCompressed()); $p['myfile.txt']->decompress(); var_dump($file->isCompressed()); } catch (Exception $e) { echo 'Create/modify failed for my.phar: ', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ int(4096) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/book.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/phar/book.xml diff -u phpdoc/en/reference/phar/book.xml:1.5 phpdoc/en/reference/phar/book.xml:1.6 --- phpdoc/en/reference/phar/book.xml:1.5 Tue Mar 25 15:36:13 2008 +++ phpdoc/en/reference/phar/book.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- Purpose: compression --> <!-- Membership: pecl --> @@ -18,7 +18,7 @@ PDO provides a unified interface for accessing different databases. Unlike PDO, which cannot convert between different databases, Phar also can convert between tar, zip and phar file formats with a single line of code. see - <function>Phar::convertToTar</function> for one example. + <function>Phar::convertToExecutable</function> for one example. </para> <para> What is phar? Phar archives are best characterized as a convenient way to group http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/fileformat.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/phar/fileformat.xml diff -u phpdoc/en/reference/phar/fileformat.xml:1.10 phpdoc/en/reference/phar/fileformat.xml:1.11 --- phpdoc/en/reference/phar/fileformat.xml:1.10 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/fileformat.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <chapter xml:id="phar.fileformat" xmlns="http://docbook.org/ns/docbook"> <title>What makes a phar a phar and not a tar or a zip?</title> <section xml:id="phar.fileformat.ingredients" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -203,8 +203,7 @@ </para> <para> To compress an entire archive, use <function>Phar::compress</function>. - To decompress an entire archive, use <function>Phar::compress</function> with - the <literal>Phar::NONE</literal> constant. + To decompress an entire archive, use <function>Phar::decompress</function>. </para> </section> <section xml:id="phar.fileformat.zip" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/using.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/phar/using.xml diff -u phpdoc/en/reference/phar/using.xml:1.11 phpdoc/en/reference/phar/using.xml:1.12 --- phpdoc/en/reference/phar/using.xml:1.11 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/using.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <chapter xml:id="phar.using" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Using Phar Archives</title> @@ -84,7 +84,7 @@ if (Phar::canWrite()) { $p = new Phar('newphar.tar.phar', 0, 'newphar.tar.phar'); // make this a tar-based phar archive, compressed with gzip compression (.tar.gz) - $p = $p->convertToTar()->compress(Phar::GZ); + $p = $p->convertToExecutable(Phar::TAR, Phar::GZ); // create transaction - nothing is written to newphar.phar // until stopBuffering() is called, although temporary storage is needed @@ -99,7 +99,7 @@ $p['data/hugefile.dat'] = $fp; if (Phar::canCompress(Phar::GZ)) { - $p['data/hugefile.dat']->setCompressedGZ(); + $p['data/hugefile.dat']->compress(Phar::GZ); } $p['images/wow.jpg'] = file_get_contents('images/wow.jpg'); @@ -138,7 +138,7 @@ </para> <para> <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ <?php @unlink('phpMyAdmin.phar.tar.php'); @@ -263,7 +263,7 @@ <para> An empty Phar archive will be created at <literal>/path/to/myphar.phar</literal>, or if <literal>/path/to/myphar.phar</literal> already exists, it will be opened - again. The literal <literal>myphar.phar</literal> deomnstrates the concept of an alias + again. The literal <literal>myphar.phar</literal> demonstrates the concept of an alias that can be used to reference <literal>/path/to/myphar.phar</literal> in URLs as in: </para> <para> @@ -298,7 +298,12 @@ (<literal>phar://myphar.phar/file.php</literal>), or overwrites an existing file within <literal>myphar.phar</literal>. <literal>$v</literal> can be either a string or an open file pointer, in which case the entire - contents of the file will be used to create the new file. + contents of the file will be used to create the new file. Note that + <literal>$p->addFromString('file.php', $v)</literal> is functionally + equivalent to the above. Also possible is to add the contents of a file + with <literal>$p->addFile('/path/to/file.php', 'file.php')</literal>. + Lastly, an empty directory can be created with + <literal>$p->addEmptyDir('empty')</literal>. </simpara> </listitem> <listitem> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromIterator.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/buildFromIterator.xml diff -u phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.2 phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.3 --- phpdoc/en/reference/phar/Phar/buildFromIterator.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/buildFromIterator.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.buildfromiterator" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromIterator</refname> @@ -167,14 +167,15 @@ </para> </refsect1> -<!-- <refsect1 role="seealso"> + + <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> - <member><link linkend="phar.arrayaccess">Using array access with Phar</link></member> + <member><function>Phar::buildFromDirectory</function></member> </simplelist> </para> - </refsect1>--> + </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/canCompress.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/canCompress.xml diff -u phpdoc/en/reference/phar/Phar/canCompress.xml:1.2 phpdoc/en/reference/phar/Phar/canCompress.xml:1.3 --- phpdoc/en/reference/phar/Phar/canCompress.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/canCompress.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.cancompress"> <refnamediv> <refname>Phar::canCompress</refname> @@ -67,19 +67,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compress.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/phar/Phar/compress.xml diff -u phpdoc/en/reference/phar/Phar/compress.xml:1.4 phpdoc/en/reference/phar/Phar/compress.xml:1.5 --- phpdoc/en/reference/phar/Phar/compress.xml:1.4 Tue Mar 25 14:04:24 2008 +++ phpdoc/en/reference/phar/Phar/compress.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compress"> <refnamediv> <refname>Phar::compress</refname> @@ -11,6 +11,7 @@ <methodsynopsis> <type>object</type><methodname>Phar::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; @@ -32,7 +33,8 @@ <para> In addition, this method automatically renames the archive, appending <literal>.gz</literal>, <literal>.bz2</literal> or removing the extension if passed <literal>Phar::NONE</literal> to - remove compression. + remove compression. Alternatively, a file extension may be specified with the second + parameter. </para> <para> A <classname>Phar</classname> object is returned. @@ -53,6 +55,18 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term><parameter>extension</parameter></term> + <listitem> + <para> + By default, the extension is <literal>.phar.gz</literal> + or <literal>.phar.bz2</literal> for compressing phar archives, and + <literal>.phar.tar.gz</literal> or <literal>.phar.tar.bz2</literal> for + compressing tar archives. For decompressing, the default file extensions + are <literal>.phar</literal> and <literal>.phar.tar</literal>. + </para> + </listitem> + </varlistentry> </variablelist> </para> @@ -95,18 +109,16 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml diff -u phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.2 phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.3 --- phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/compressAllFilesBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressallfilesbzip2"> <refnamediv> <refname>Phar::compressAllFilesBZIP2</refname> @@ -13,7 +13,8 @@ <type>bool</type><methodname>Phar::compressAllFilesBZIP2</methodname> <void/> </methodsynopsis> - &phar.write; + &phar.removed.pharcompress; + &phar.write; <para> This method compresses all files in the Phar archive using bzip2 compression. @@ -106,8 +107,6 @@ <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml diff -u phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.2 phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.3 --- phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/compressAllFilesGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressallfilesgz"> <refnamediv> <refname>Phar::compressAllFilesGZ</refname> @@ -12,7 +12,8 @@ <type>bool</type><methodname>Phar::compressAllFilesGZ</methodname> <void/> </methodsynopsis> - &phar.write; + &phar.removed.pharcompress; + &phar.write; <para> For tar-based phar archives, this method compresses the entire archive using @@ -111,8 +112,6 @@ <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/getSupportedCompression.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/getSupportedCompression.xml diff -u phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.2 phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.3 --- phpdoc/en/reference/phar/Phar/getSupportedCompression.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/getSupportedCompression.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.getsupportedcompression" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::getSupportedCompression</refname> @@ -38,19 +38,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>Phar::compress</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isCompressed.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/phar/Phar/isCompressed.xml diff -u phpdoc/en/reference/phar/Phar/isCompressed.xml:1.3 phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 --- phpdoc/en/reference/phar/Phar/isCompressed.xml:1.3 Wed Apr 9 10:58:08 2008 +++ phpdoc/en/reference/phar/Phar/isCompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="phar.iscompressed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isCompressed</refname> @@ -72,19 +72,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>Phar::decompress</function></member> + <member><function>Phar::compress</function></member> <member><function>Phar::canCompress</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compressFiles</function></member> + <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isPhar.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isPhar.xml diff -u phpdoc/en/reference/phar/Phar/isPhar.xml:1.2 phpdoc/en/reference/phar/Phar/isPhar.xml:1.3 --- phpdoc/en/reference/phar/Phar/isPhar.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isPhar.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.isphar" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isPhar</refname> @@ -35,8 +35,8 @@ <simplelist> <member><function>Phar::isTar</function></member> <member><function>Phar::isZip</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::convertToZip</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isTar.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isTar.xml diff -u phpdoc/en/reference/phar/Phar/isTar.xml:1.2 phpdoc/en/reference/phar/Phar/isTar.xml:1.3 --- phpdoc/en/reference/phar/Phar/isTar.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isTar.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.istar" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isTar</refname> @@ -36,8 +36,8 @@ <simplelist> <member><function>Phar::isPhar</function></member> <member><function>Phar::isZip</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToZip</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isZip.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isZip.xml diff -u phpdoc/en/reference/phar/Phar/isZip.xml:1.2 phpdoc/en/reference/phar/Phar/isZip.xml:1.3 --- phpdoc/en/reference/phar/Phar/isZip.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isZip.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.iszip" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isZip</refname> @@ -35,8 +35,8 @@ <simplelist> <member><function>Phar::isPhar</function></member> <member><function>Phar::isTar</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> + <member><function>Phar::convertToExecutable</function></member> + <member><function>Phar::convertToData</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml diff -u phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.2 phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.3 --- phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/uncompressAllFiles.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.uncompressallfiles"> <refnamediv> <refname>Phar::uncompressAllFiles</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>Phar::uncompressAllFiles</methodname> <void/> </methodsynopsis> + &phar.removed.pharcompress; &phar.write; @@ -112,8 +113,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/chmod.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/chmod.xml diff -u phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/chmod.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/chmod.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phargileinfo.chmod"> <refnamediv> <refname>PharFileInfo::chmod</refname> @@ -17,6 +17,11 @@ file permissions bit, as well as read-only bits. Writeable bits are ignored, and set at runtime based on the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable. + As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml diff -u phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/delMetadata.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phargileinfo.delmetadata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharFileInfo::delMetadata</refname> @@ -28,6 +28,11 @@ &reftitle.returnvalues; <para> Returns &true; if successful, &false; if the entry had no metadata. + As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml diff -u phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/getCompressedSize.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.getcompressedsize"> <refnamediv> <refname>PharFileInfo::getCompressedSize</refname> @@ -58,20 +58,16 @@ &reftitle.seealso; <para> <simplelist> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> <member><function>PharFileInfo::isCompressed</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> + <member><function>Phar::compress</function></member> + <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::decompressFiles</function></member> + <member><function>Phar::compressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressed"> <refnamediv> <refname>PharFileInfo::isCompressed</refname> @@ -64,19 +64,15 @@ <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> - <member><function>PharFileInfo::isCompressedBZIP2</function></member> - <member><function>PharFileInfo::isCompressedGZ</function></member> - <member><function>PharFileInfo::setCompressedBZIP2</function></member> - <member><function>PharFileInfo::setUncompressed</function></member> - <member><function>PharFileInfo::setCompressedGZ</function></member> + <member><function>PharFileInfo::decompress</function></member> + <member><function>PharFileInfo::compress</function></member> + <member><function>Phar::decompress</function></member> + <member><function>Phar::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> - <member><function>Phar::compressAllFilesBZIP2</function></member> - <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> - <member><function>Phar::uncompressAllFiles</function></member> + <member><function>Phar::decompressFiles</function></member> + <member><function>Phar::compressFiles</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressedBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressedbzip2"> <refnamediv> <refname>PharFileInfo::isCompressedBZIP2</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::isCompressedBZIP2</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This returns whether a file is compressed within a Phar archive @@ -79,8 +80,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml diff -u phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/isCompressedGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.iscompressedgz"> <refnamediv> <refname>PharFileInfo::isCompressedGZ</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::isCompressedGZ</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This returns whether a file is compressed within a Phar archive @@ -79,8 +80,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setCompressedBZIP2.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setcompressedbzip2"> <refnamediv> <refname>PharFileInfo::setCompressedBZIP2</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setCompressedBZIP2</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method compresses the file inside the Phar archive using bzip2 compression. @@ -80,8 +81,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setCompressedGZ.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setcompressedgz"> <refnamediv> <refname>PharFileInfo::setCompressedGZ</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setCompressedGZ</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method compresses the file inside the Phar archive using gzip compression. @@ -80,8 +81,6 @@ <member><function>Phar::compressAllFilesBZIP2</function></member> <member><function>Phar::compressAllFilesGZ</function></member> <member><function>Phar::getSupportedCompression</function></member> - <member><function>Phar::convertToPhar</function></member> - <member><function>Phar::convertToTar</function></member> <member><function>Phar::uncompressAllFiles</function></member> </simplelist> </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setMetadata.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setmetadata"> <refnamediv> <refname>PharFileInfo::setMetaData</refname> @@ -19,10 +19,11 @@ archive if the data is large, or if there are many files containing meta-data. It is important to note that file permissions are natively supported inside a phar; it is possible to set them with the - <function>PharFileInfo::chmod</function> method. As with all - functionality that modifies the contents of a phar, the - <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be - off in order to succeed. + <function>PharFileInfo::chmod</function> method. As with all functionality that modifies the contents of + a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable + must be off in order to succeed if the file is within a <classname>Phar</classname> + archive. Files within <classname>PharData</classname> archives do not have + this restriction. </para> <para> Some possible uses for meta-data include passing a user/group that should be set http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml diff -u phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.2 phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.3 --- phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/PharFileInfo/setUncompressed.xml Thu May 1 03:28:07 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setuncompressed"> <refnamediv> <refname>PharFileInfo::setUncompressed</refname> @@ -11,6 +11,7 @@ <type>bool</type><methodname>PharFileInfo::setUncompressed</methodname> <void/> </methodsynopsis> + &phar.removed.pharfileinfocompress; <para> This method decompresses the file inside the Phar archive. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromDirectory.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/buildFromDirectory.xml +++ phpdoc/en/reference/phar/Phar/buildFromDirectory.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromDirectory</refname> <refpurpose>Construct a phar archive from the files within a directory.</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::buildFromDirectory</methodname> <methodparam><type>string</type><parameter>base_dir</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>regex</parameter></methodparam> </methodsynopsis> &phar.write; <para> Populate a phar archive from a directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>Phar::buildFromIterator</function>. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>A <function>Phar::buildFromDirectory</function> example</title> <para> </para> <para> <programlisting role="php"> <![CDATA[ <?php // create with alias "project.phar" $phar = new Phar('project.phar', 0, 'project.phar'); // add all files in the project $phar->buildFromDirectory(dirname(__FILE__) . '/project'); $phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); $phar2 = new Phar('project2.phar', 0, 'project2.phar'); // add all files in the project, only include php files $phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); $phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); ?> ]]> </programlisting> </para> </example> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>base_dir</parameter></term> <listitem> <para> The full or relative path to the directory that contains all files to add to the archive. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>regex</parameter></term> <listitem> <para> An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> <function>Phar::buildFromDirectory</function> returns an associative array mapping internal path of file to the full path of the file on the filesystem. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to instantiate the internal directory iterators, or a <classname>PharException</classname> if there were errors saving the phar archive. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::buildFromIterator</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/compressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/compressFiles.xml +++ phpdoc/en/reference/phar/Phar/compressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.compressfiles"> <refnamediv> <refname>Phar::compressFiles</refname> <refpurpose>Compresses all files in the current Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::compressFiles</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> &phar.write; <para> For tar-based phar archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>Phar::compress</function> to compress an entire tar-based phar archive. </para> <para> For Zip-based and phar-based phar archives, this method compresses all files in the Phar archive using the specified compression. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::compressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?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->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/convertToData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/convertToData.xml +++ phpdoc/en/reference/phar/Phar/convertToData.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.converttodata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::convertToData</refname> <refpurpose>Convert a phar archive to a non-executable tar or zip file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>PharData</type><methodname>Phar::convertToData</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> This method is used to convert an executable phar archive to either a tar or zip file. To make the tar or zip non-executable, the phar stub and phar alias files are removed from the newly created archive. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname> if the archive is in phar file format. For archives in tar or zip file format, this method converts the archive to a non-executable archive. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>PharData</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::TAR</literal> or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that <literal>.phar</literal> cannot be used anywhere in the filename for a non-executable tar or zip archive. </para> <para> If converting to a tar-based phar archive, the default extensions are <literal>.tar</literal>, <literal>.tar.gz</literal>, and <literal>.tar.bz2</literal> depending on specified compression. For zip-based archives, the default extension is <literal>.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>PharData</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>Phar::startBuffering</function> and has not concluded with <function>Phar::stopBuffering</function>, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::convertToData</function> example</title> <para> Using Phar::convertToData(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new Phar('myphar.phar.tar'); // note that myphar.phar.tar is *not* unlinked // convert it to the non-executable tar file format // creates myphar.tar $tar = $tarphar->comvertToData(); // convert to non-executable zip format, creates myphar.zip $zip = $tarphar->convertToData(Phar::ZIP); // create myphar.tbz $tgz = $tarphar->convertToData(Phar::TAR, Phar::BZ2, '.tbz'); // creates myphar.phar.tgz $phar = $tarphar->convertToData(Phar::PHAR); // throws exception } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>PharData::convertToExecutable</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/convertToExecutable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/convertToExecutable.xml +++ phpdoc/en/reference/phar/Phar/convertToExecutable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.converttoexecutable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::convertToExecutable</refname> <refpurpose>Convert a phar archive to another executable phar archive file format</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>Phar</type><methodname>Phar::convertToExecutable</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is used to convert a phar archive to another file format. For instance, it can be used to create a tar-based executable phar archive from a zip-based executable phar archive, or from an executable phar archive in the phar file format. In addition, it can be used to apply whole-archive compression to a tar or phar-based archive. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>Phar</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::PHAR</literal>, <literal>Phar::TAR</literal>, or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that all zip- and tar-based phar archives must contain <literal>.phar</literal> in their file extension in order to be processed as a phar archive. </para> <para> If converting to a phar-based archive, the default extensions are <literal>.phar</literal>, <literal>.phar.gz</literal>, or <literal>.phar.bz2</literal> depending on the specified compression. For tar-based phar archives, the default extensions are <literal>.phar.tar</literal>, <literal>.phar.tar.gz</literal>, and <literal>.phar.tar.bz2</literal>. For zip-based phar archives, the default extension is <literal>.phar.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>Phar</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>Phar::startBuffering</function> and has not concluded with <function>Phar::stopBuffering</function>, an <classname>UnexpectedValueException</classname> if write support is disabled, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::convertToExecutable</function> example</title> <para> Using Phar::convertToExecutable(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new Phar('myphar.phar.tar'); // convert it to the phar file format // note that myphar.phar.tar is *not* unlinked $phar = $tarphar->convertToExecutable(Phar::PHAR); // creates myphar.phar $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); // creates myphar.phar.tgz $compressed = $phar->convertToExecutable(Phar::TAR, Phar::GZ, '.phar.tgz'); } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToExecutable</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/decompress.xml +++ phpdoc/en/reference/phar/Phar/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.decompress"> <refnamediv> <refname>Phar::decompress</refname> <refpurpose>Decompresses the entire Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>Phar::decompress</methodname> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> For tar-based and phar-based phar archives, this method decompresses the entire archive. </para> <para> For Zip-based phar archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to decompress an archive compressed with with gzip compression, and the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to decompress an archive compressed with bzip2 compression. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> <para> In addition, this method automatically changes the file extension of the archive, <literal>.phar</literal> by default for phar archives, or <literal>.phar.tar</literal> for tar-based phar archives. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>Phar</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> For decompressing, the default file extensions are <literal>.phar</literal> and <literal>.phar.tar</literal>. Use this parameter to specify another file extension. Be aware that all executable phar archives must contain <literal>.phar</literal> in their filename. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar.gz'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p3 = $p2->decompress(); // creates /path/to/my.phar ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/decompressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/decompressFiles.xml +++ phpdoc/en/reference/phar/Phar/decompressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.decompressfiles"> <refnamediv> <refname>Phar::decompressFiles</refname> <refpurpose>Decompresses all files in the current Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::decompressFiles</methodname> <void /> </methodsynopsis> &phar.write; <para> For tar-based phar archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>Phar::compress</function> to compress an entire tar-based phar archive. </para> <para> For Zip-based and phar-based phar archives, this method decompresses all files in the Phar archive. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature if any files are compressed using bzip2/zlib compression. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::decompressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->decompressFiles(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/compress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/compress.xml +++ phpdoc/en/reference/phar/PharData/compress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.compress"> <refnamediv> <refname>PharData::compress</refname> <refpurpose>Compresses the entire tar/zip archive using Gzip or Bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>PharData::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> <methodparam><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> For tar archives, this method compresses the entire archive using gzip compression or bzip2 compression. The resulting file can be processed with the gunzip command/bunzip command, or accessed directly and transparently with the Phar extension. </para> <para> For zip archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to compress with gzip compression, the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to compress with bzip2 compression. </para> <para> In addition, this method automatically renames the archive, appending <literal>.gz</literal>, <literal>.bz2</literal> or removing the extension if passed <literal>Phar::NONE</literal> to remove compression. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>PharData</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> By default, the extension is <literal>.tar.gz</literal> or <literal>.tar.bz2</literal> for compressing a tar, and <literal>.tar</literal> for decompressing. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::compress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.tar'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p1 = $p->compress(Phar::GZ); // copies to /path/to/my.phar.gz $p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.phar.bz2 $p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.phar already exists ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::compress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/compressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/compressFiles.xml +++ phpdoc/en/reference/phar/PharData/compressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.compressfiles"> <refnamediv> <refname>PharData::compressFiles</refname> <refpurpose>Compresses all files in the current tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::compressFiles</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> <para> For tar-based archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>PharData::compress</function> to compress an entire tar-based archive. </para> <para> For Zip-based archives, this method compresses all files in the archive using the specified compression. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> Compression must be one of <literal>Phar::GZ</literal>, <literal>Phar::BZ2</literal> to add compression, or <literal>Phar::NONE</literal> to remove compression. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::compressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?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->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::decompressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compress</function></member> <member><function>PharData::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/convertToData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/convertToData.xml +++ phpdoc/en/reference/phar/PharData/convertToData.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.converttodata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::convertToData</refname> <refpurpose>Convert a phar archive to a non-executable tar or zip file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>PharData</type><methodname>PharData::convertToData</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> This method is used to convert a non-executable tar or zip archive to another non-executable format. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. This method should be used to convert a tar archive to zip format or vice-versa. Although it is possible to simply change the compression of a tar archive using this method, it is better to use the <function>PharData::compress</function> method for logical consistency. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>PharData</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::TAR</literal> or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that <literal>.phar</literal> cannot be used anywhere in the filename for a non-executable tar or zip archive. </para> <para> If converting to a tar-based phar archive, the default extensions are <literal>.tar</literal>, <literal>.tar.gz</literal>, and <literal>.tar.bz2</literal> depending on specified compression. For zip-based archives, the default extension is <literal>.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>PharData</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>PharData::startBuffering</function> and has not concluded with <function>PharData::stopBuffering</function>, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::convertToData</function> example</title> <para> Using PharData::convertToData(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new PharData('myphar.tar'); // note that myphar.tar is *not* unlinked // convert it to the non-executable tar file format // creates myphar.zip $zip = $tarphar->convertToData(Phar::ZIP); // create myphar.tbz $tgz = $zip->convertToData(Phar::TAR, Phar::BZ2, '.tbz'); // creates myphar.phar.tgz $phar = $tarphar->convertToData(Phar::PHAR); // throws exception } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToExecutable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/convertToExecutable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/convertToExecutable.xml +++ phpdoc/en/reference/phar/PharData/convertToExecutable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.converttoexecutable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::convertToExecutable</refname> <refpurpose>Convert a non-executable tar/zip archive to an executable phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>Phar</type><methodname>PharData::convertToExecutable</methodname> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>compression</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is used to convert a non-executable tar or zip archive to an executable phar archive. Any of the three executable file formats (phar, tar or zip) can be used, and whole-archive compression can also be performed. </para> <para> If no changes are specified, this method throws a <classname>BadMethodCallException</classname>. </para> <para> If successful, the method creates a new archive on disk and returns a <classname>Phar</classname> object. The old archive is not removed from disk, and should be done manually after the process has finished. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>format</parameter></term> <listitem> <para> This should be one of <literal>Phar::PHAR</literal>, <literal>Phar::TAR</literal>, or <literal>Phar::ZIP</literal>. If set to &null;, the existing file format will be preserved. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>compression</parameter></term> <listitem> <para> This should be one of <literal>Phar::NONE</literal> for no whole-archive compression, <literal>Phar::GZ</literal> for zlib-based compression, and <literal>Phar::BZ2</literal> for bzip-based compression. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> This parameter is used to override the default file extension for a converted archive. Note that all zip- and tar-based phar archives must contain <literal>.phar</literal> in their file extension in order to be processed as a phar archive. </para> <para> If converting to a phar-based archive, the default extensions are <literal>.phar</literal>, <literal>.phar.gz</literal>, or <literal>.phar.bz2</literal> depending on the specified compression. For tar-based phar archives, the default extensions are <literal>.phar.tar</literal>, <literal>.phar.tar.gz</literal>, and <literal>.phar.tar.bz2</literal>. For zip-based phar archives, the default extension is <literal>.phar.zip</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The method returns a <classname>Phar</classname> object on success and throws an exception on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to compress, an unknown compression method has been specified, the requested archive is buffering with <function>PharData::startBuffering</function> and has not concluded with <function>PharData::stopBuffering</function>, an <classname>UnexpectedValueException</classname> if write support is disabled, and a <classname>PharException</classname> if any problems are encountered during the phar creation process. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::convertToExecutable</function> example</title> <para> Using PharData::convertToExecutable(): </para> <programlisting role="php"> <![CDATA[ <?php try { $tarphar = new PharData('myphar.tar'); // convert it to the phar file format // note that myphar.tar is *not* unlinked $phar = $tarphar->convertToExecutable(Phar::PHAR); // creates myphar.phar $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); // creates myphar.phar.tgz $compressed = $tarphar->convertToExecutable(Phar::TAR, Phar::GZ, '.phar.tgz'); } catch (Exception $e) { // handle the error here } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::convertToExecutable</function></member> <member><function>Phar::convertToData</function></member> <member><function>PharData::convertToData</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/decompress.xml +++ phpdoc/en/reference/phar/PharData/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.decompress"> <refnamediv> <refname>PharData::decompress</refname> <refpurpose>Decompresses the entire Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>object</type><methodname>PharData::decompress</methodname> <methodparam choice="opt"><type>string</type><parameter>extension</parameter></methodparam> </methodsynopsis> <para> For tar-based archives, this method decompresses the entire archive. </para> <para> For Zip-based archives, this method fails with an exception. The <link linkend="ref.zlib">zlib</link> extension must be enabled to decompress an archive compressed with with gzip compression, and the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order to decompress an archive compressed with bzip2 compression. </para> <para> In addition, this method automatically renames the file extension of the archive, <literal>.tar</literal> by default. Alternatively, a file extension may be specified with the second parameter. </para> <para> A <classname>PharData</classname> object is returned. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>extension</parameter></term> <listitem> <para> For decompressing, the default file extension is <literal>.phar.tar</literal>. Use this parameter to specify another file extension. Be aware that no non-executable archives cannot contain <literal>.phar</literal> in their filename. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.tar', 0, 'my.tar.gz'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p3 = $p2->decompress(); // creates /path/to/my.tar ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::compress</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compressFiles</function></member> <member><function>PharData::decompressFiles</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/decompressFiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/decompressFiles.xml +++ phpdoc/en/reference/phar/PharData/decompressFiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.decompressfiles"> <refnamediv> <refname>PharData::decompressFiles</refname> <refpurpose>Decompresses all files in the current zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::decompressFiles</methodname> <void /> </methodsynopsis> &phar.write; <para> For tar-based archives, this method throws a <classname>BadMethodCallException</classname>, as compression of individual files within a tar archive is not supported by the file format. Use <function>PharData::compress</function> to compress an entire tar-based archive. </para> <para> For Zip-based archives, this method decompresses all files in the archive. The <link linkend="ref.zlib">zlib</link> or <link linkend="ref.bzip2">bzip2</link> extensions must be enabled to take advantage of this feature if any files are compressed using bzip2/zlib compression. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ref.zlib">zlib</link> extension is not available, or if any files are compressed using bzip2 compression and the <link linkend="ref.bzip2">bzip2</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::decompressFiles</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.zip'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p->compressFiles(Phar::GZ); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } $p->decompressFiles(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressed(Phar::BZ2)); var_dump($file->isCompressed(Phar::GZ)); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>PharData::compressFiles</function></member> <member><function>Phar::getSupportedCompression</function></member> <member><function>PharData::compress</function></member> <member><function>PharData::decompress</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/offsetUnset.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/offsetUnset.xml +++ phpdoc/en/reference/phar/PharData/offsetUnset.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.offsetunset"> <refnamediv> <refname>PharData::offsetUnset</refname> <refpurpose>remove a file from a tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::offsetUnset</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the <interfacename>ArrayAccess</interfacename> interface allowing direct manipulation of the contents of a tar/zip archive using array access brackets. offsetUnset is used for deleting an existing file, and is called by the <function>unset</function> language construct. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> The filename (relative path) to modify in the tar/zip archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if there are any problems flushing changes made to the tar/zip archive to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::offsetUnset</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new PharData('/path/to/my.zip'); try { // deletes file.txt from my.zip by calling offsetUnset unset($p['file.txt']); } catch (Exception $e) { echo 'Could not delete file.txt: ', $e; } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::offsetUnset</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setMetadata.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setMetadata.xml +++ phpdoc/en/reference/phar/PharData/setMetadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="phardata.setmetadata"> <refnamediv> <refname>Phar::setMetadata</refname> <refpurpose>Sets phar archive meta-data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::setMetadata</methodname> <methodparam><type>mixed</type><parameter>metadata</parameter></methodparam> </methodsynopsis> &phar.write; <para> <function>Phar::setMetadata</function> should be used to store customized data that describes something about the phar archive as a complete entity. <function>PharFileInfo::setMetadata</function> should be used for file-specific meta-data. Meta-data can slow down the performance of loading a phar archive if the data is large. </para> <para> Some possible uses for meta-data include specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like <link xlink:href="http://pear.php.net">PEAR</link>'s package.xml file. However, any useful data that describes the phar archive may be stored. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>metadata</parameter></term> <listitem> <para> Any PHP variable containing information to store that describes the phar archive </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::setMetadata</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file.php'] = '<?php echo "hello"'; $p->setMetadata(array('bootstrap' => 'file.php')); var_dump($p->getMetadata()); } catch (Exception $e) { echo 'Could not create and/or modify phar:', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(1) { ["bootstrap"]=> string(8) "file.php" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::getMetadata</function></member> <member><function>Phar::delMetadata</function></member> <member><function>Phar::hasMetadata</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml +++ phpdoc/en/reference/phar/PharData/setSignatureAlgorithm.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.setsignaturealgorithm" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::setSignatureAlgorithm</refname> <refpurpose>set the signature algorithm for a phar and apply it. The</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::setSignatureAlgorithm</methodname> <methodparam><type>int</type><parameter>sigtype</parameter></methodparam> </methodsynopsis> &phar.write; <para> set the signature algorithm for a phar and apply it. The signature algorithm must be one of <literal>Phar::MD5</literal>, <literal>Phar::SHA1</literal>, <literal>Phar::SHA256</literal>, <literal>Phar::SHA512</literal>, or <literal>Phar::PGP</literal> (pgp not yet supported and falls back to SHA-1). </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>sigtype</parameter></term> <listitem> <para> One of <literal>Phar::MD5</literal>, <literal>Phar::SHA1</literal>, <literal>Phar::SHA256</literal>, <literal>Phar::SHA512</literal>, or <literal>Phar::PGP</literal> </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>UnexpectedValueException</classname> for many errors, <classname>BadMethodCallException</classname> if called for a zip- or a tar-based phar archive, and a <classname>PharException</classname> if any problems occur flushing changes to disk. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::getSupportedSignatures</function></member> <member><function>Phar::getSignature</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/compress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharFileInfo/compress.xml +++ phpdoc/en/reference/phar/PharFileInfo/compress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.compress"> <refnamediv> <refname>PharFileInfo::compress</refname> <refpurpose>Compresses the current Phar entry with either zlib or bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo::compress</methodname> <methodparam><type>int</type><parameter>compression</parameter></methodparam> </methodsynopsis> <para> This method compresses the file inside the Phar archive using either bzip2 compression or zlib compression. The <link linkend="ref.bzip2">bzip2</link> or <link linkend="ref.zlib">zlib</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed, the respective extension must be enabled in order to decompress the file. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed if the file is within a <classname>Phar</classname> archive. Files within <classname>PharData</classname> archives do not have this restriction. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>/<link linkend="ref.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo::compress</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressed(Phar::BZ2)); $p['myfile.txt']->compress(Phar::BZ2); var_dump($file->isCompressed(Phar::BZ2)); } catch (Exception $e) { echo 'Create/modify operations on my.phar failed: ', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::decompress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharFileInfo/decompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharFileInfo/decompress.xml +++ phpdoc/en/reference/phar/PharFileInfo/decompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.decompress"> <refnamediv> <refname>PharFileInfo::decompress</refname> <refpurpose>Decompresses the current Phar entry within the phar</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo::decompress</methodname> <void/> </methodsynopsis> <para> This method decompresses the file inside the Phar archive. Depending on how the file is compressed, the <link linkend="ref.bzip2">bzip2</link> or <link linkend="ref.zlib">zlib</link> extensions must be enabled to take advantage of this feature. As with all functionality that modifies the contents of a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be off in order to succeed if the file is within a <classname>Phar</classname> archive. Files within <classname>PharData</classname> archives do not have this restriction. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>/<link linkend="ref.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo::decompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; $file->compress(Phar::GZ); var_dump($file->isCompressed()); $p['myfile.txt']->decompress(); var_dump($file->isCompressed()); } catch (Exception $e) { echo 'Create/modify failed for my.phar: ', $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ int(4096) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::getCompressedSize</function></member> <member><function>PharFileInfo::isCompressed</function></member> <member><function>PharFileInfo::compress</function></member> <member><function>Phar::canCompress</function></member> <member><function>Phar::isCompressed</function></member> <member><function>Phar::compressFiles</function></member> <member><function>Phar::decompressFiles</function></member> <member><function>Phar::compress</function></member> <member><function>Phar::decompress</function></member> <member><function>Phar::getSupportedCompression</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->