cvs: phpdoc /en/reference/phar reference.xml /en/reference/phar/functions Phar-beginWrite.xml Phar-commitWrite.xml Phar-count.xml
Phar-getSignature.xml Phar-getStub.xml PharFileInfo-getMetaData.xml PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml
PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml
| From: | Greg Beaver | Date: | Sun, 28 Jan 2007 05:31:52 +0000 |
| Subject: | cvs: phpdoc /en/reference/phar reference.xml /en/reference/phar/functions Phar-beginWrite.xml Phar-commitWrite.xml Phar-count.xml Phar-getSignature.xml Phar-getStub.xml PharFileInfo-getMetaData.xml PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969375055@lists.php.net to get a copy of this message | ||
cellog Sun Jan 28 05:31:52 2007 UTC
Added files:
/phpdoc/en/reference/phar/functions Phar-beginWrite.xml
Phar-commitWrite.xml
Phar-getSignature.xml
Phar-getStub.xml
PharFileInfo-getMetaData.xml
PharFileInfo-setCompressedBZIP2.xml
PharFileInfo-setCompressedGZ.xml
PharFileInfo-setMetaData.xml
PharFileInfo-setUncompressed.xml
Modified files:
/phpdoc/en/reference/phar reference.xml
/phpdoc/en/reference/phar/functions Phar-count.xml
Log:
add docs for new functionality, update docs for old, fix a small typo
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/reference.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/reference.xml diff -u phpdoc/en/reference/phar/reference.xml:1.2 phpdoc/en/reference/phar/reference.xml:1.3 --- phpdoc/en/reference/phar/reference.xml:1.2 Wed Jan 24 04:37:45 2007 +++ phpdoc/en/reference/phar/reference.xml Sun Jan 28 05:31:51 2007 @@ -1,5 +1,5 @@ <?xml version = '1.0' encoding = 'iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- Purpose: --> <!-- Membership: pecl --> <reference id="ref.phar" > @@ -37,7 +37,7 @@ <section id="phar.requirements" > &reftitle.required; <para> - Phar requires PHP 5.2.0 or newer. Additional features require the + Phar requires PHP 5.2.1 or newer. Additional features require the <link linkend="ref.spl">SPL</link> extension in order to take advantage of iteration and array access to a Phar's file contents. The <literal>phar</literal> stream does not require any additional extensions to function. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-count.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-count.xml diff -u phpdoc/en/reference/phar/functions/Phar-count.xml:1.1 phpdoc/en/reference/phar/functions/Phar-count.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-count.xml:1.1 Thu Jan 18 00:24:34 2007 +++ phpdoc/en/reference/phar/functions/Phar-count.xml Sun Jan 28 05:31:52 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.Phar-count"> <refnamediv> <refname>Phar->count</refname> @@ -24,7 +24,8 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - The number of files containd within this phar, or 0 (the number zero) if none. + The number of files contained within this phar, or <literal>0</literal> (the number zero) + if none. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-beginWrite.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-beginWrite.xml +++ phpdoc/en/reference/phar/functions/Phar-beginWrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-beginWrite"> <refnamediv> <refname>Phar->beginWrite</refname> <refpurpose>Begin a Phar modification transaction</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar->beginWrite</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>beginWrite</function> method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. </para> <para> However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the <function>beginWrite</function>/<function>commitWrite</function> pair of methods is provided for this purpose. </para> <para> Phar transactions are per-archive, a transaction active on the <literal>foo.phar</literal> Phar archive does not affect changes to the <literal>bar.phar</literal> Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->beginWrite</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p->count() . " entries\n"; $p->beginWrite(); $p['file.txt'] = 'hi'; $p['file2.txt'] = 'there'; $p['file2.txt']->setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']->setMetaData(42); $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?>"); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-commitWrite"><function>Phar->commitWrite</function></link></member> <member><link linkend="function.Phar-getStub"><function>Phar->getStub</function></link></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/functions/Phar-commitWrite.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-commitWrite.xml +++ phpdoc/en/reference/phar/functions/Phar-commitWrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-commitWrite"> <refnamediv> <refname>Phar->commitWrite</refname> <refpurpose>End a Phar modification transaction by writing the Phar archive to disk</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar->commitWrite</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>beginWrite</function> method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. </para> <para> However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the <function>beginWrite</function>/<function>commitWrite</function> pair of methods is provided for this purpose. </para> <para> Phar transactions are per-archive, a transaction active on the <literal>foo.phar</literal> Phar archive does not affect changes to the <literal>bar.phar</literal> Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->commitWrite</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file1.txt'] = 'hi'; $p->commitWrite(); var_dump($p->getStub()); $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; __HALT_COMPILER(); ?>"); var_dump($p->getStub()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(24) "<?php __HALT_COMPILER();" string(186) "<?php function __autoload() { include 'phar://' . str_replace('_', '/', ); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; __HALT_COMPILER(); ?>" ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-beginWrite"><function>Phar->beginWrite</function></link></member> <member><link linkend="function.Phar-getStub"><function>Phar->getStub</function></link></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/functions/Phar-getSignature.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-getSignature.xml +++ phpdoc/en/reference/phar/functions/Phar-getSignature.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-getSignature"> <refnamediv> <refname>Phar->getSignature</refname> <refpurpose>Return MD5/SHA1 signature of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar->getSignature</methodname> <void/> </methodsynopsis> <para> Returns the verification signature of a phar archive in a hexadecimal string. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The opened archive's signature. This signature is a hash calculated on the entire phar's contents, and may be used to verify the integrity of the archive. A valid signature is absolutely required of all phars if the <link linkend="ini.phar.require-hash">phar.require_hash</link> INI variable is set to true. </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/functions/Phar-getStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-getStub.xml +++ phpdoc/en/reference/phar/functions/Phar-getStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-getStub"> <refnamediv> <refname>Phar->getStub</refname> <refpurpose>Return the PHP loader or bootstrap stub of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar->getStub</methodname> <void/> </methodsynopsis> <para> One of the features that differentiates a Phar archive from other familiar archive formats like tar or zip is that a Phar archive is explicitly designed to be included to allow distributing an application or library that can be run without extraction directly from the archive. In order to accomplish this, Phar archives contain a bootstrap loader, or <literal>stub</literal> written in PHP that can perform any action. </para> <warning> <simpara>All stubs must end with <literal>__HALT_COMPILER();</literal> or the file is not a valid Phar archive.</simpara> </warning> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns a string containing the contents of the bootstrap loader (stub) of the current Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->getStub</function> example</title> <programlisting role="php"> <![CDATA[ $p = new Phar('myphar.phar'); echo $p->getStub(); echo "==NEXT==\n"; $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?>"); echo $p->getStub(); ]]> </programlisting> &example.outputs; <screen> <![CDATA[ <?php __HALT_COMPILER(); ==NEXT== <?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?> ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-commitWrite"><function>Phar->commitWrite</function></link></member> <member><link linkend="function.Phar-beginWrite"><function>Phar->beginWrite</function></link></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/functions/PharFileInfo-getMetaData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-getMetaData.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-getMetaData.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-getMetaData"> <refnamediv> <refname>PharFileInfo->getMetaData</refname> <refpurpose>Returns file-specific meta-data saved with a file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo->getMetaData</methodname> <void/> </methodsynopsis> <para> </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> any PHP variable that can be serialized and is stored as meta-data for the file, or &null; if no meta-data is stored. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->getMetaData</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.txt'] = 'hello'; $p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain')); var_dump($p['file.txt']->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["user"]=> string(4) "bill" ["mime-type"]=> string(10) "text/plain" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-setMetaData"><function>PharFileInfo->setMetaData</function></link></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/functions/PharFileInfo-setCompressedBZIP2.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setCompressedBZIP2"> <refnamediv> <refname>PharFileInfo->setCompressedBZIP2</refname> <refpurpose>Compresses the current Phar entry within the phar using Bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setCompressedBZIP2</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be compressed using bzip2 compression. The <link linkend="ref.bzip2">bzip2</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using gzip compression, the <link linkend="ref.zlib">zlib</link> 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. </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> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setCompressedBZIP2</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedBZIP2()); $p['myfile.txt']->setCompressedBZIP2(); var_dump($file->isCompressedBZIP2()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo->isCompressed</function></link></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/functions/PharFileInfo-setCompressedGZ.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setCompressedGZ"> <refnamediv> <refname>PharFileInfo->setCompressedGZ</refname> <refpurpose>Compresses the current Phar entry within the phar using gz compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setCompressedGZ</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be compressed using gzip compression. The <link linkend="ref.zlib">zlib</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using bzip2 compression, the <link linkend="ref.bzip2">bzip2</link> 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. </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.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setCompressedGZ</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedGZ()); $p['myfile.txt']->setCompressedGZ(); var_dump($file->isCompressedGZ()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo->isCompressed</function></link></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/functions/PharFileInfo-setMetaData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setMetaData.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setMetaData.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setMetaData"> <refnamediv> <refname>PharFileInfo->getMetaData</refname> <refpurpose>Sets file-specific meta-data saved with a file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo->setMetaData</methodname> <void/> </methodsynopsis> <para> <function>setMetaData</function> should only be used to store customized data in a file that cannot be represented with existing information stored with a file. Meta-data can significantly slow down the performance of loading a phar 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, and you can use <function>chmod</function> to change the permissions of files inside a phar. 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> Some possible uses for meta-data include passing a user/group that should be set when a file is extracted from the phar to disk. Other uses could include explicitly specifying a MIME type to return. However, any useful data that describes a file, but should not be contained inside of it 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 alongside a file </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setMetaData</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.txt'] = 'hello'; $p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain')); var_dump($p['file.txt']->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["user"]=> string(4) "bill" ["mime-type"]=> string(10) "text/plain" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getMetaData"><function>PharFileInfo->getMetaData</function></link></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/functions/PharFileInfo-setUncompressed.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setUncompressed.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setUncompressed.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setUncompressed"> <refnamediv> <refname>PharFileInfo->setUncompressed</refname> <refpurpose>Uncompresses the current Phar entry within the phar, if it is compressed</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setUncompressed</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be uncompressed and re-saved. 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. </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->setUncompressed</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; $file->setCompressedGZ(); var_dump($file->isCompressed()); $p['myfile.txt']->setUncompressed(); var_dump($file->isCompressed()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(true) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo->isCompressed</function></link></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/reference.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/reference.xml diff -u phpdoc/en/reference/phar/reference.xml:1.2 phpdoc/en/reference/phar/reference.xml:1.3 --- phpdoc/en/reference/phar/reference.xml:1.2 Wed Jan 24 04:37:45 2007 +++ phpdoc/en/reference/phar/reference.xml Sun Jan 28 05:31:51 2007 @@ -1,5 +1,5 @@ <?xml version = '1.0' encoding = 'iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- Purpose: --> <!-- Membership: pecl --> <reference id="ref.phar" > @@ -37,7 +37,7 @@ <section id="phar.requirements" > &reftitle.required; <para> - Phar requires PHP 5.2.0 or newer. Additional features require the + Phar requires PHP 5.2.1 or newer. Additional features require the <link linkend="ref.spl">SPL</link> extension in order to take advantage of iteration and array access to a Phar's file contents. The <literal>phar</literal> stream does not require any additional extensions to function. http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-count.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/functions/Phar-count.xml diff -u phpdoc/en/reference/phar/functions/Phar-count.xml:1.1 phpdoc/en/reference/phar/functions/Phar-count.xml:1.2 --- phpdoc/en/reference/phar/functions/Phar-count.xml:1.1 Thu Jan 18 00:24:34 2007 +++ phpdoc/en/reference/phar/functions/Phar-count.xml Sun Jan 28 05:31:52 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.Phar-count"> <refnamediv> <refname>Phar->count</refname> @@ -24,7 +24,8 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - The number of files containd within this phar, or 0 (the number zero) if none. + The number of files contained within this phar, or <literal>0</literal> (the number zero) + if none. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/Phar-beginWrite.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-beginWrite.xml +++ phpdoc/en/reference/phar/functions/Phar-beginWrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-beginWrite"> <refnamediv> <refname>Phar->beginWrite</refname> <refpurpose>Begin a Phar modification transaction</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar->beginWrite</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>beginWrite</function> method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. </para> <para> However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the <function>beginWrite</function>/<function>commitWrite</function> pair of methods is provided for this purpose. </para> <para> Phar transactions are per-archive, a transaction active on the <literal>foo.phar</literal> Phar archive does not affect changes to the <literal>bar.phar</literal> Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->beginWrite</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p->count() . " entries\n"; $p->beginWrite(); $p['file.txt'] = 'hi'; $p['file2.txt'] = 'there'; $p['file2.txt']->setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']->setMetaData(42); $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?>"); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-commitWrite"><function>Phar->commitWrite</function></link></member> <member><link linkend="function.Phar-getStub"><function>Phar->getStub</function></link></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/functions/Phar-commitWrite.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-commitWrite.xml +++ phpdoc/en/reference/phar/functions/Phar-commitWrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-commitWrite"> <refnamediv> <refname>Phar->commitWrite</refname> <refpurpose>End a Phar modification transaction by writing the Phar archive to disk</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar->commitWrite</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>beginWrite</function> method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. </para> <para> However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the <function>beginWrite</function>/<function>commitWrite</function> pair of methods is provided for this purpose. </para> <para> Phar transactions are per-archive, a transaction active on the <literal>foo.phar</literal> Phar archive does not affect changes to the <literal>bar.phar</literal> Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->commitWrite</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file1.txt'] = 'hi'; $p->commitWrite(); var_dump($p->getStub()); $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; __HALT_COMPILER(); ?>"); var_dump($p->getStub()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(24) "<?php __HALT_COMPILER();" string(186) "<?php function __autoload() { include 'phar://' . str_replace('_', '/', ); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; __HALT_COMPILER(); ?>" ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-beginWrite"><function>Phar->beginWrite</function></link></member> <member><link linkend="function.Phar-getStub"><function>Phar->getStub</function></link></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/functions/Phar-getSignature.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-getSignature.xml +++ phpdoc/en/reference/phar/functions/Phar-getSignature.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-getSignature"> <refnamediv> <refname>Phar->getSignature</refname> <refpurpose>Return MD5/SHA1 signature of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar->getSignature</methodname> <void/> </methodsynopsis> <para> Returns the verification signature of a phar archive in a hexadecimal string. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The opened archive's signature. This signature is a hash calculated on the entire phar's contents, and may be used to verify the integrity of the archive. A valid signature is absolutely required of all phars if the <link linkend="ini.phar.require-hash">phar.require_hash</link> INI variable is set to true. </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/functions/Phar-getStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/Phar-getStub.xml +++ phpdoc/en/reference/phar/functions/Phar-getStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Phar-getStub"> <refnamediv> <refname>Phar->getStub</refname> <refpurpose>Return the PHP loader or bootstrap stub of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar->getStub</methodname> <void/> </methodsynopsis> <para> One of the features that differentiates a Phar archive from other familiar archive formats like tar or zip is that a Phar archive is explicitly designed to be included to allow distributing an application or library that can be run without extraction directly from the archive. In order to accomplish this, Phar archives contain a bootstrap loader, or <literal>stub</literal> written in PHP that can perform any action. </para> <warning> <simpara>All stubs must end with <literal>__HALT_COMPILER();</literal> or the file is not a valid Phar archive.</simpara> </warning> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns a string containing the contents of the bootstrap loader (stub) of the current Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar->getStub</function> example</title> <programlisting role="php"> <![CDATA[ $p = new Phar('myphar.phar'); echo $p->getStub(); echo "==NEXT==\n"; $p->commitWrite("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?>"); echo $p->getStub(); ]]> </programlisting> &example.outputs; <screen> <![CDATA[ <?php __HALT_COMPILER(); ==NEXT== <?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER(); ?> ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.Phar-commitWrite"><function>Phar->commitWrite</function></link></member> <member><link linkend="function.Phar-beginWrite"><function>Phar->beginWrite</function></link></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/functions/PharFileInfo-getMetaData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-getMetaData.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-getMetaData.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-getMetaData"> <refnamediv> <refname>PharFileInfo->getMetaData</refname> <refpurpose>Returns file-specific meta-data saved with a file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo->getMetaData</methodname> <void/> </methodsynopsis> <para> </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> any PHP variable that can be serialized and is stored as meta-data for the file, or &null; if no meta-data is stored. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->getMetaData</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.txt'] = 'hello'; $p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain')); var_dump($p['file.txt']->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["user"]=> string(4) "bill" ["mime-type"]=> string(10) "text/plain" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-setMetaData"><function>PharFileInfo->setMetaData</function></link></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/functions/PharFileInfo-setCompressedBZIP2.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedBZIP2.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setCompressedBZIP2"> <refnamediv> <refname>PharFileInfo->setCompressedBZIP2</refname> <refpurpose>Compresses the current Phar entry within the phar using Bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setCompressedBZIP2</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be compressed using bzip2 compression. The <link linkend="ref.bzip2">bzip2</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using gzip compression, the <link linkend="ref.zlib">zlib</link> 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. </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> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setCompressedBZIP2</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedBZIP2()); $p['myfile.txt']->setCompressedBZIP2(); var_dump($file->isCompressedBZIP2()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo->isCompressed</function></link></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/functions/PharFileInfo-setCompressedGZ.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setCompressedGZ.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setCompressedGZ"> <refnamediv> <refname>PharFileInfo->setCompressedGZ</refname> <refpurpose>Compresses the current Phar entry within the phar using gz compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setCompressedGZ</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be compressed using gzip compression. The <link linkend="ref.zlib">zlib</link> extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using bzip2 compression, the <link linkend="ref.bzip2">bzip2</link> 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. </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.zlib">zlib</link> extension is not available. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setCompressedGZ</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedGZ()); $p['myfile.txt']->setCompressedGZ(); var_dump($file->isCompressedGZ()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo->isCompressed</function></link></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/functions/PharFileInfo-setMetaData.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setMetaData.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setMetaData.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setMetaData"> <refnamediv> <refname>PharFileInfo->getMetaData</refname> <refpurpose>Sets file-specific meta-data saved with a file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo->setMetaData</methodname> <void/> </methodsynopsis> <para> <function>setMetaData</function> should only be used to store customized data in a file that cannot be represented with existing information stored with a file. Meta-data can significantly slow down the performance of loading a phar 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, and you can use <function>chmod</function> to change the permissions of files inside a phar. 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> Some possible uses for meta-data include passing a user/group that should be set when a file is extracted from the phar to disk. Other uses could include explicitly specifying a MIME type to return. However, any useful data that describes a file, but should not be contained inside of it 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 alongside a file </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo->setMetaData</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.txt'] = 'hello'; $p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain')); var_dump($p['file.txt']->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["user"]=> string(4) "bill" ["mime-type"]=> string(10) "text/plain" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getMetaData"><function>PharFileInfo->getMetaData</function></link></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/functions/PharFileInfo-setUncompressed.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/PharFileInfo-setUncompressed.xml +++ phpdoc/en/reference/phar/functions/PharFileInfo-setUncompressed.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.PharFileInfo-setUncompressed"> <refnamediv> <refname>PharFileInfo->setUncompressed</refname> <refpurpose>Uncompresses the current Phar entry within the phar, if it is compressed</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo->setUncompressed</methodname> <void/> </methodsynopsis> <para> This method causes the file referenced to be uncompressed and re-saved. 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. </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->setUncompressed</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; $file->setCompressedGZ(); var_dump($file->isCompressed()); $p['myfile.txt']->setUncompressed(); var_dump($file->isCompressed()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(true) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member> <member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo->isCompressed</function></link></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 -->