cvs: phpdoc /en/reference/phar using.xml /en/reference/phar/functions Phar-apiVersion.xml Phar-begin.xml Phar-canCompress.xml Phar-canWrite.xml
Phar-commit.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-construct.xml Phar-count.xml Phar-getMetaData.xml Phar-getModified.xml
Phar-getSignature.xml Phar-getStub.xml Phar-getVersion.xml Phar-isFlushingToPhar.xml Phar-loadPhar.xml Phar-mapPhar.xml Phar-offsetExists.xml
Phar-offsetGet.xml Phar-offsetSet.xml Phar-offsetUnset.xml Phar-setMetaData.xml Phar-setStub.xml Phar-uncompressAllFiles.xml
PharFileInfo-construct.xml PharFileInfo-getCRC32.xml PharFileInfo-getCompressedSize.xml PharFileInfo-getMetaData.xml PharFileInfo-getPharFlags.xml
PharFileInfo-isCRCChecked.xml PharFileInfo-isCompressed.xml PharFileInfo-isCompressedBZIP2.xml PharFileInfo-isCompressedGZ.xml
PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml phar-apivers!
ion.xml phar-begin.xml phar-cancompress.xml phar-canwrite.xml phar-commit.xml phar-compressallfilesbzip2.xml phar-compressallfilesgz.xml
phar-construct.xml phar-count.xml phar-getmetadata.xml phar-getmodified.xml phar-getsignature.xml phar-getstub.xml phar-getversion.xml
phar-isflushingtophar.xml phar-loadphar.xml phar-mapphar.xml phar-offsetexists.xml phar-offsetget.xml phar-offsetset.xml phar-offsetunset.xml
phar-setmetadata.xml phar-setstub.xml phar-uncompressallfiles.xml pharfileinfo-construct.xml pharfileinfo-getcompressedsize.xml
pharfileinfo-getcrc32.xml pharfileinfo-getmetadata.xml pharfileinfo-getpharflags.xml pharfileinfo-iscompressed.xml pharfileinfo-iscompressedbzip2.xml
pharfileinfo-iscompressedgz.xml pharfileinfo-iscrcchecked.xml pharfileinfo-setcompressedbzip2.xml pharfileinfo-setcompressedgz.xml
pharfileinfo-setmetadata.xml pharfileinfo-setuncompressed.xml

From: Date: Sat, 03 Feb 2007 05:16:53 +0000
Subject: cvs: phpdoc /en/reference/phar using.xml /en/reference/phar/functions Phar-apiVersion.xml Phar-begin.xml Phar-canCompress.xml Phar-canWrite.xml
Phar-commit.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-construct.xml Phar-count.xml Phar-getMetaData.xml Phar-getModified.xml
Phar-getSignature.xml Phar-getStub.xml Phar-getVersion.xml Phar-isFlushingToPhar.xml Phar-loadPhar.xml Phar-mapPhar.xml Phar-offsetExists.xml
Phar-offsetGet.xml Phar-offsetSet.xml Phar-offsetUnset.xml Phar-setMetaData.xml Phar-setStub.xml Phar-uncompressAllFiles.xml
PharFileInfo-construct.xml PharFileInfo-getCRC32.xml PharFileInfo-getCompressedSize.xml PharFileInfo-getMetaData.xml PharFileInfo-getPharFlags.xml
PharFileInfo-isCRCChecked.xml PharFileInfo-isCompressed.xml PharFileInfo-isCompressedBZIP2.xml PharFileInfo-isCompressedGZ.xml
PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml phar-apivers!
ion.xml phar-begin.xml phar-cancompress.xml phar-canwrite.xml phar-commit.xml phar-compressallfilesbzip2.xml phar-compressallfilesgz.xml
phar-construct.xml phar-count.xml phar-getmetadata.xml phar-getmodified.xml phar-getsignature.xml phar-getstub.xml phar-getversion.xml
phar-isflushingtophar.xml phar-loadphar.xml phar-mapphar.xml phar-offsetexists.xml phar-offsetget.xml phar-offsetset.xml phar-offsetunset.xml
phar-setmetadata.xml phar-setstub.xml phar-uncompressallfiles.xml pharfileinfo-construct.xml pharfileinfo-getcompressedsize.xml
pharfileinfo-getcrc32.xml pharfileinfo-getmetadata.xml pharfileinfo-getpharflags.xml pharfileinfo-iscompressed.xml pharfileinfo-iscompressedbzip2.xml
pharfileinfo-iscompressedgz.xml pharfileinfo-iscrcchecked.xml pharfileinfo-setcompressedbzip2.xml pharfileinfo-setcompressedgz.xml
pharfileinfo-setmetadata.xml pharfileinfo-setuncompressed.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969375186@lists.php.net to get a copy of this message
cellog Sat Feb 3 05:16:53 2007 UTC Added files: /phpdoc/en/reference/phar/functions phar-apiversion.xml phar-begin.xml phar-cancompress.xml phar-canwrite.xml phar-commit.xml phar-compressallfilesbzip2.xml phar-compressallfilesgz.xml phar-construct.xml phar-count.xml phar-getmetadata.xml phar-getmodified.xml phar-getsignature.xml phar-getstub.xml phar-getversion.xml phar-isflushingtophar.xml phar-loadphar.xml phar-mapphar.xml phar-offsetexists.xml phar-offsetget.xml phar-offsetset.xml phar-offsetunset.xml phar-setmetadata.xml phar-setstub.xml phar-uncompressallfiles.xml pharfileinfo-construct.xml pharfileinfo-getcompressedsize.xml pharfileinfo-getcrc32.xml pharfileinfo-getmetadata.xml pharfileinfo-getpharflags.xml pharfileinfo-iscompressed.xml pharfileinfo-iscompressedbzip2.xml pharfileinfo-iscompressedgz.xml pharfileinfo-iscrcchecked.xml pharfileinfo-setcompressedbzip2.xml pharfileinfo-setcompressedgz.xml pharfileinfo-setmetadata.xml pharfileinfo-setuncompressed.xml Removed files: /phpdoc/en/reference/phar/functions Phar-apiVersion.xml Phar-begin.xml Phar-canCompress.xml Phar-canWrite.xml Phar-commit.xml Phar-compressAllFilesBZIP2.xml Phar-compressAllFilesGZ.xml Phar-construct.xml Phar-count.xml Phar-getMetaData.xml Phar-getModified.xml Phar-getSignature.xml Phar-getStub.xml Phar-getVersion.xml Phar-isFlushingToPhar.xml Phar-loadPhar.xml Phar-mapPhar.xml Phar-offsetExists.xml Phar-offsetGet.xml Phar-offsetSet.xml Phar-offsetUnset.xml Phar-setMetaData.xml Phar-setStub.xml Phar-uncompressAllFiles.xml PharFileInfo-construct.xml PharFileInfo-getCRC32.xml PharFileInfo-getCompressedSize.xml PharFileInfo-getMetaData.xml PharFileInfo-getPharFlags.xml PharFileInfo-isCRCChecked.xml PharFileInfo-isCompressed.xml PharFileInfo-isCompressedBZIP2.xml PharFileInfo-isCompressedGZ.xml PharFileInfo-setCompressedBZIP2.xml PharFileInfo-setCompressedGZ.xml PharFileInfo-setMetaData.xml PharFileInfo-setUncompressed.xml Modified files: /phpdoc/en/reference/phar using.xml Log: strtolower() all files and identifiers, fix a few minor problems found in the doc links too

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/using.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/using.xml diff -u phpdoc/en/reference/phar/using.xml:1.1 phpdoc/en/reference/phar/using.xml:1.2 --- phpdoc/en/reference/phar/using.xml:1.1 Sun Jan 28 21:45:44 2007 +++ phpdoc/en/reference/phar/using.xml Sat Feb 3 05:16:52 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <section id="phar.using.basics"> <title>Using Phar Archives: Introduction</title> <para> @@ -191,10 +191,10 @@ <para> In addition, the <classname>Phar</classname> object is the only way to access Phar-specific metadata, through - <link linkend="function.Phar-getMetaData"><function>Phar-&gt;getMetaData</function></link>, + <link linkend="function.phar-getmetadata"><function>Phar-&gt;getMetaData</function></link>, and the only way to set or retrieve a Phar archive's PHP loader stub through - <link linkend="function.Phar-getStub"><function>Phar-&gt;getStub</function></link> and - <link linkend="function.Phar-commit"><function>Phar-&gt;commit</function></link>. + <link linkend="function.phar-getstub"><function>Phar-&gt;getStub</function></link> and + <link linkend="function.phar-setstub"><function>Phar-&gt;setStub</function></link>. Additionally, compression for the entire Phar archive at once can only be manipulated using the <classname>Phar</classname> class. </para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/functions/phar-apiversion.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-apiversion.xml +++ phpdoc/en/reference/phar/functions/phar-apiversion.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-apiversion"> <refnamediv> <refname>Phar::apiVersion</refname> <refpurpose>Returns the api version</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar::apiVersion</methodname> <void/> </methodsynopsis> <para> Return the API version of the phar file format that will be used when creating phars. The Phar extension supports reading API version 1.0.0 or newer. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The API version string as in <literal>&quot;1.0.0&quot;</literal>. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::apiVersion</function> example</title> <programlisting role="php"> <![CDATA[ <?php echo Phar::apiVersion(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ 1.0.0 ]]> </screen> </example> </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-begin.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-begin.xml +++ phpdoc/en/reference/phar/functions/phar-begin.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-begin"> <refnamediv> <refname>Phar-&gt;begin</refname> <refpurpose>Begin a Phar modification transaction</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar-&gt;begin</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>begin</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>begin</function>/<function>commit</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-&gt;begin</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'); } catch (Exception $e) { echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p->count() . " entries\n"; $p->begin(); $p['file.txt'] = 'hi'; $p['file2.txt'] = 'there'; $p['file2.txt']->setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']->setMetaData(42); $p->setStub("<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER();"); $p->commit(); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-commit"><function>Phar-&gt;commit</function></link></member> <member><link linkend="function.phar-getstub"><function>Phar-&gt;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-cancompress.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-cancompress.xml +++ phpdoc/en/reference/phar/functions/phar-cancompress.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-cancompress"> <refnamediv> <refname>Phar::canCompress</refname> <refpurpose>Returns whether phar extension supports compression using either zlib or bzip2</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::canCompress</methodname> <void/> </methodsynopsis> <para> This should be used to test whether compression is possible prior to loading a phar archive containing compressed files. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if compression/decompression is available, &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::canCompress</function> example</title> <programlisting role="php"> <![CDATA[ <?php if (Phar::canCompress()) { echo file_get_contents('phar://whatever.phar/internal/file.txt'); } else { echo 'no compression available'; } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharFileInfo::isCompressed</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/functions/phar-canwrite.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-canwrite.xml +++ phpdoc/en/reference/phar/functions/phar-canwrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-canwrite"> <refnamediv> <refname>Phar::canWrite</refname> <refpurpose>Returns whether phar extension supports writing and creating phars</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::canWrite</methodname> <void/> </methodsynopsis> <para> This method determines whether write access has been disabled in the system php.ini via the <link linkend="ini.phar.readonly">phar.readonly</link> ini variable. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if write access is enabled, &false; if it is disabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::canWrite</function> example</title> <programlisting role="php"> <![CDATA[ <?php if (Phar::canWrite()) { file_put_contents('phar://myphar.phar/file.txt', 'hi there'); } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="ini.phar.readonly">phar.readonly</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-commit.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-commit.xml +++ phpdoc/en/reference/phar/functions/phar-commit.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-commit"> <refnamediv> <refname>Phar-&gt;commit</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-&gt;commit</methodname> <void/> </methodsynopsis> <para> Although technically unnecessary, the <function>begin</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>begin</function>/<function>commit</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="errors"> &reftitle.errors; <para> <classname>PharException</classname> is thrown if any problems are encountered flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;commit</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->commit(); var_dump($p->getStub()); $p->setStub("<?php function __autoload(\$class) { include 'phar://' . str_replace('_', '/', \$class); } Phar::mapPhar('brandnewphar.phar'); include 'phar://brandnewphar.phar/startup.php'; __HALT_COMPILER();"); $p->commit(); var_dump($p->getStub()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(24) "<?php __HALT_COMPILER();" string(195) "<?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } 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-begin"><function>Phar-&gt;begin</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-compressallfilesbzip2.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-compressallfilesbzip2.xml +++ phpdoc/en/reference/phar/functions/phar-compressallfilesbzip2.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-compressallfilesbzip2"> <refnamediv> <refname>Phar-&gt;compressAllFilesBZIP2</refname> <refpurpose>Compresses all files in the current Phar archive using Bzip2 compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar-&gt;compressAllFilesBZIP2</methodname> <void/> </methodsynopsis> <para> This method causes all files in the Phar archive 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 any files are 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, the <link linkend="ref.bzip2">bzip2</link> extension is not available, or if any files are compressed using gzip compression and the <link linkend="ref.zlib">zlib</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;compressAllFilesBZIP2</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->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } $p->compressAllFilesBZIP2(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } ?> ]]> </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" bool(true) bool(true) bool(false) string(11) "myfile2.txt" bool(true) bool(true) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedbzip2"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-setuncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-uncompressallfiles"><function>Phar-&gt;uncompressAllFiles</function></link></member> <member><link linkend="function.phar-compressallfilesgz"><function>Phar-&gt;compressAllFilesGZ</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-compressallfilesgz.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-compressallfilesgz.xml +++ phpdoc/en/reference/phar/functions/phar-compressallfilesgz.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-compressallfilesgz"> <refnamediv> <refname>Phar-&gt;compressAllFilesGZ</refname> <refpurpose>Compresses all files in the current Phar archive using Gzip compression</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar-&gt;compressAllFilesGZ</methodname> <void/> </methodsynopsis> <para> This method causes all files in the Phar archive 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 any files are 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, 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-&gt;compressAllFilesGZ</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->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } $p->compressAllFilesGZ(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } ?> ]]> </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" bool(true) bool(false) bool(true) string(11) "myfile2.txt" bool(true) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-getcompressedsize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-setuncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-uncompressallfiles"><function>Phar-&gt;uncompressAllFiles</function></link></member> <member><link linkend="function.phar-compressallfilesbzip2"><function>Phar-&gt;compressAllFilesBZIP2</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-construct.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-construct.xml +++ phpdoc/en/reference/phar/functions/phar-construct.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-construct"> <refnamediv> <refname>Phar::__construct</refname> <refpurpose>Construct a Phar archive object</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::__construct</methodname> <methodparam><type>string</type><parameter>fname</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam> </methodsynopsis> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>fname</parameter></term> <listitem> <para> Path to an existing Phar archive </para> </listitem> </varlistentry> <varlistentry> <term><parameter>flags</parameter></term> <listitem> <para> flags to pass to parent class <classname>RecursiveDirectoryIterator</classname>. See <ulink url="http://www.php.net/~helly/php/ext/spl/classRecursiveDirectoryIterator.html#be0e1176d512c66500e5c26f248c89c4">SPL RecursiveDirectoryIterator docs</ulink> </para> </listitem> </varlistentry> <varlistentry> <term><parameter>alias</parameter></term> <listitem> <para> Alias with which this Phar archive should be referred to in calls to stream functionality. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws BadMethodCallException if called twice, UnexpectedValueException if the phar archive can't be opened. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::__construct</function> example</title> <para> <programlisting role="php"> <![CDATA[ <?php try { $p = new Phar('/path/to/my.phar', CURRENT_AS_FILEINFO | KEY_AS_FILENAME, 'my.phar'); } catch (UnexpectedValueException $e) { die('Could not open my.phar'); } catch (BadMethodCallException $e) { echo 'technically, this cannot happen'; } // this works now echo file_get_contents('phar://my.phar/example.txt'); // and works as if we had typed echo file_get_contents('phar:///path/to/my.phar/example.txt'); ?> ]]> </programlisting> </para> </example> </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-count.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-count.xml +++ phpdoc/en/reference/phar/functions/phar-count.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-count"> <refnamediv> <refname>Phar-&gt;count</refname> <refpurpose>Returns the number of entries (files) in the Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar-&gt;count</methodname> <void/> </methodsynopsis> <para> </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The number of files contained within this phar, or <literal>0</literal> (the number zero) if none. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;count</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'); } catch (Exception $e) { echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p->count() . " entries\n"; $p['file.txt'] = 'hi'; echo 'The new phar has ' . $p->count() . " entries\n"; ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ The new phar has 0 entries The new phar has 1 entries ]]> </screen> </example> </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-getmetadata.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-getmetadata.xml +++ phpdoc/en/reference/phar/functions/phar-getmetadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-getmetadata"> <refnamediv> <refname>Phar-&gt;getMetaData</refname> <refpurpose>Returns phar archive meta-data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar-&gt;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 Phar archive, or &null; if no meta-data is stored. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;getMetaData</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'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.php'] = '<?php echo "hello";'; $p->setMetaData(array('bootstrap' => 'file.php')); var_dump($p->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(1) { ["bootstrap"]=> string(8) "file.php" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-setmetadata"><function>PharFileInfo-&gt;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/phar-getmodified.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-getmodified.xml +++ phpdoc/en/reference/phar/functions/phar-getmodified.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-getmodified"> <refnamediv> <refname>Phar-&gt;getModified</refname> <refpurpose>Return whether phar was modified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar-&gt;getModified</methodname> <void/> </methodsynopsis> <para> This method can be used to determine whether a phar has either had an internal file deleted, or contents of a file changed in some way. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if the phar has been modified since opened, &false; if not. </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-&gt;getSignature</refname> <refpurpose>Return MD5/SHA1 signature of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar-&gt;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> Array with the opened archive's signature in "hash" key and "md5" or "sha1" in "hash_type". 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-&gt;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-&gt;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="errors"> &reftitle.errors; <para> Throws <classname>RuntimeException</classname> if it is not possible to read the stub from the Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;getStub</function> example</title> <programlisting role="php"> <![CDATA[ $p = new Phar('/path/to/my.phar', 0, 'my.phar'); echo $p->getStub(); echo "==NEXT==\n"; $p->setStub("<?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-setstub"><function>Phar-&gt;setStub</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-getversion.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-getversion.xml +++ phpdoc/en/reference/phar/functions/phar-getversion.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-getversion"> <refnamediv> <refname>Phar-&gt;getVersion</refname> <refpurpose>Return version info of Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar-&gt;getVersion</methodname> <void/> </methodsynopsis> <para> Returns the API version of an opened Phar archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The opened archive's API version. This is not to be confused with the API version that the loaded phar extension will use to create new phars. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::apiVersion</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/functions/phar-isflushingtophar.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-isflushingtophar.xml +++ phpdoc/en/reference/phar/functions/phar-isflushingtophar.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-isflushingtophar"> <refnamediv> <refname>Phar-&gt;isFlushingToPhar</refname> <refpurpose>Used to determine whether a Phar creation transaction is active</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar-&gt;isFlushingToPhar</methodname> <void/> </methodsynopsis> <para> This method can be used to determine whether a Phar will save changes to disk immediately, or whether a call to <function>Phar-&gt;commit</function> is needed to enable saving changes. </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-&gt;isFlushingToPhar</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file1.txt'] = 'hi'; var_dump($p->isFlushingToPhar()); $p->begin(); var_dump($p->isFlushingToPhar()); $p->commit(); var_dump($p->isFlushingToPhar()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(true) bool(false) bool(true) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-begin"><function>Phar-&gt;begin</function></link></member> <member><link linkend="function.phar-commit"><function>Phar-&gt;commit</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-loadphar.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-loadphar.xml +++ phpdoc/en/reference/phar/functions/phar-loadphar.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-loadphar"> <refnamediv> <refname>Phar::loadPhar</refname> <refpurpose>Loads any phar archive with an alias</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::loadPhar</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam> </methodsynopsis> <para> This can be used to read the contents of an external Phar archive. This is most useful for assigning an alias to a phar so that subsequent references to the phar can use the shorter alias. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>filename</parameter></term> <listitem> <para> the full or relative path to the phar archive to open </para> </listitem> </varlistentry> <varlistentry> <term><parameter>alias</parameter></term> <listitem> <para> The alias that may be used to refer to the phar archive. Note that many phar archives specify an explicit alias inside the phar archive, and a <classname>PharException</classname> will be thrown if a new alias is specified in this case. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> <classname>PharException</classname> is thrown if an alias is passed in and the phar archive already has an explicit alias </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::loadPhar</function> example</title> <para> Phar::loadPhar can be used anywhere to load an external Phar archive, whereas Phar::mapPhar should be used in a loader stub for a Phar. </para> <programlisting role="php"> <![CDATA[ <?php try { Phar::loadPhar('/path/to/phar.phar', 'my.phar'); echo file_get_contents('phar://my.phar/file.txt'); } catch (PharException $e) { echo $e; } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::mapPhar</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/functions/phar-mapphar.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-mapphar.xml +++ phpdoc/en/reference/phar/functions/phar-mapphar.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-mapphar"> <refnamediv> <refname>Phar::mapPhar</refname> <refpurpose>Reads the currently executed file (a phar) and registers its manifest</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::mapPhar</methodname> <methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam> </methodsynopsis> <para> This static method should be used inside a Phar archive's loader stub in order to initialize the phar. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>alias</parameter></term> <listitem> <para> The alias with which this phar should be referred to. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> <classname>PharException</classname> is thrown if not called directly within PHP execution, if no __HALT_COMPILER(); token is found in the current source file, or if the file cannot be opened for reading. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::mapPhar</function> example</title> <para> mapPhar should be used only inside a phar's loader stub. Use loadPhar to load an external phar into memory. </para> <para> Here is a sample Phar loader stub that uses mapPhar. </para> <programlisting role="php"> <![CDATA[ <?php function __autoload($class) { include 'phar://' . str_replace('_', '/', $class); } try { Phar::mapPhar('me.phar'); include 'phar://me.phar/startup.php'; } catch (PharException $e) { echo $e->getMessage(); die('Cannot initialize Phar'); } __HALT_COMPILER(); ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::loadPhar</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/functions/phar-offsetexists.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-offsetexists.xml +++ phpdoc/en/reference/phar/functions/phar-offsetexists.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-offsetexists"> <refnamediv> <refname>Phar::offsetExists</refname> <refpurpose>determines whether a file exists in the phar</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::offsetExists</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the ArrayAccess interface allowing direct manipulation of the contents of a Phar archive using array access brackets. </para> <para> offsetExists() is called whenever <function>isset</function> is called. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> The filename (relative path) to look for in a Phar. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the file exists within the phar, or &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::offsetExists</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/my.phar', 0, 'my.phar'); $p['firstfile.txt'] = 'first file'; $p['secondfile.txt'] = 'second file'; // the next set of lines call offsetExists() indirectly var_dump(isset($p['firstfile.txt'])); var_dump(isset($p['nothere.txt'])); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(true) bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-offsetget"><function>Phar::offsetGet</function></link></member> <member><link linkend="function.phar-offsetset"><function>Phar::offsetSet</function></link></member> <member><link linkend="function.phar-offsetunset"><function>Phar::offsetUnset</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-offsetget.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-offsetget.xml +++ phpdoc/en/reference/phar/functions/phar-offsetget.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-offsetget"> <refnamediv> <refname>Phar::offsetGet</refname> <refpurpose>get a PharFileInfo object for a specific file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar::offsetGet</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the ArrayAccess interface allowing direct manipulation of the contents of a Phar archive using array access brackets. offsetGet is used for retrieving files from a Phar archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> The filename (relative path) to look for in a Phar. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> A <classname>PharFileInfo</classname> object is returned that can be used to iterate over a file's contents or to retrieve information about the current file. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> if the file does not exist in the Phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::offsetGet</function> example</title> <para> As with all classes that implement the <classname>ArrayAccess</classname> interface, offsetGet is automatically called when using the [] angle bracket operator </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/myphar.phar', 0, 'myphar.phar'); $p['exists.txt'] = "file exists\n"; try { // automatically calls offsetGet() echo $p['exists.txt']; echo $p['doesnotexist.txt']; } catch (BadMethodCallException $e) { echo $e; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ file exists Entry doesnotexist.txt does not exist ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-offsetexists"><function>Phar::offsetExists</function></link></member> <member><link linkend="function.phar-offsetset"><function>Phar::offsetSet</function></link></member> <member><link linkend="function.phar-offsetunset"><function>Phar::offsetUnset</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-offsetset.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-offsetset.xml +++ phpdoc/en/reference/phar/functions/phar-offsetset.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-offsetset"> <refnamediv> <refname>Phar::offsetSet</refname> <refpurpose>set the contents of an internal file to those of an external file</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::offsetSet</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> <methodparam><type>string</type><parameter>value</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the ArrayAccess interface allowing direct manipulation of the contents of a Phar archive using array access brackets. offsetSet is used for modifying an existing file, or adding a new file to a Phar archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>offset</parameter></term> <listitem> <para> The filename (relative path) to modify in a Phar. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>value</parameter></term> <listitem> <para> Content of the file. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> No return values. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> if <link linkend="ini.phar.readonly">phar.readonly</link> is <literal>1</literal>, <classname>BadMethodCallException</classname> is thrown, as modifying a Phar is only allowed when phar.readonly is set to <literal>0</literal>. Throws <classname>PharException</classname> if there are any problems flushing changes made to the Phar archive to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::offsetSet</function> example</title> <para> offsetSet should not be accessed directly, but instead used via array access with the [] operator. </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); // calls offsetSet $p['file.txt'] = 'Hi there'; ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-offsetexists"><function>Phar::offsetExists</function></link></member> <member><link linkend="function.phar-offsetget"><function>Phar::offsetGet</function></link></member> <member><link linkend="function.phar-offsetunset"><function>Phar::offsetUnset</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-offsetunset.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-offsetunset.xml +++ phpdoc/en/reference/phar/functions/phar-offsetunset.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-offsetunset"> <refnamediv> <refname>Phar::offsetUnset</refname> <refpurpose>remove a file from a phar</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::offsetUnset</methodname> <methodparam><type>string</type><parameter>offset</parameter></methodparam> </methodsynopsis> <para> This is an implementation of the ArrayAccess interface allowing direct manipulation of the contents of a Phar 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 a Phar. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> if <link linkend="ini.phar.readonly">phar.readonly</link> is <literal>1</literal>, <classname>BadMethodCallException</classname> is thrown, as modifying a Phar is only allowed when phar.readonly is set to <literal>0</literal>. Throws <classname>PharException</classname> if there are any problems flushing changes made to the Phar archive to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::offsetUnset</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); // deletes file.txt from my.phar by calling offsetUnset unset($p['file.txt']); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-offsetexists"><function>Phar::offsetExists</function></link></member> <member><link linkend="function.phar-offsetget"><function>Phar::offsetGet</function></link></member> <member><link linkend="function.phar-offsetset"><function>Phar::offsetSet</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-setmetadata.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-setmetadata.xml +++ phpdoc/en/reference/phar/functions/phar-setmetadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-setmetadata"> <refnamediv> <refname>Phar-&gt;setMetaData</refname> <refpurpose>Sets phar archive meta-data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar-&gt;setMetaData</methodname> <void/> </methodsynopsis> <para> <function>setMetaData</function> should only be used to store customized data that describes something about the phar archive as a complete entity. <link linkend="function.pharfileinfo-setmetadata"><function>PharFileInfo-&gt;setMetaData</function></link> should be used for file-specific meta-data. Meta-data can significantly slow down the performance of loading a phar archive if the data is large. 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 specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like <ulink url="http://pear.php.net">PEAR</ulink>'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-&gt;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'); } catch (Exception $e) { echo 'Could not create phar:', $e; } $p['file.php'] = '<?php echo "hello"'; $p->setMetaData(array('bootstrap' => 'file.php')); var_dump($p->getMetaData()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(1) { ["bootstrap"]=> string(8) "file.php" } ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-getmetadata"><function>Phar-&gt;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/phar-setstub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-setstub.xml +++ phpdoc/en/reference/phar/functions/phar-setstub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-setstub"> <refnamediv> <refname>Phar-&gt;setStub</refname> <refpurpose>Used to set the PHP loader or bootstrap stub of a Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar-&gt;setStub</methodname> <void/> </methodsynopsis> <para> This method is used to add a PHP bootstrap loader stub to a new Phar archive, or to replace the loader stub in an existing Phar archive. </para> <para> The loader stub for a Phar archive is used whenever an archive is included directly as in this example: </para> <programlisting role="php"> <![CDATA[ <?php include 'myphar.phar'; ?> ]]> </programlisting> <para> The loader is not accessed when including a file through the <literal>phar</literal> stream wrapper like so: </para> <programlisting role="php"> <![CDATA[ <?php include 'phar://myphar.phar/somefile.php'; ?> ]]> </programlisting> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> <classname>UnexpectedValueException</classname> is thrown if <link linkend="ini.phar.readonly">phar.readonly</link> is enabled in php.ini. <classname>PharException</classname> is thrown if any problems are encountered flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;setStub</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['a.php'] = '<?php var_dump("Hello");'; $p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>'); include 'phar://brandnewphar.phar/a.php'; var_dump($p->getStub()); $p['b.php'] = '<?php var_dump("World");'; $p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>'); include 'phar://brandnewphar.phar/b.php'; var_dump($p->getStub()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(5) "Hello" string(82) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>" string(5) "World" string(83) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>" ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.phar-getstub"><function>Phar-&gt;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-uncompressallfiles.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/phar-uncompressallfiles.xml +++ phpdoc/en/reference/phar/functions/phar-uncompressallfiles.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.phar-uncompressallfiles"> <refnamediv> <refname>Phar-&gt;uncompressAllFiles</refname> <refpurpose>Uncompresses all files in the current Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar-&gt;uncompressAllFiles</methodname> <void/> </methodsynopsis> <para> This method causes all files in the Phar archive to be uncompressed. If any files are already compressed using gzip compression, the <link linkend="ref.zlib">zlib</link> extension must be enabled in order to decompress the file, and any files compressed using bzip2 compression require the <link linkend="ref.bzip2">bzip2</link> extension 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, the <link linkend="ref.bzip2">bzip2</link> extension is not enabled and any files are compressed using bzip2 compression, or if any files are compressed using gzip compression and the <link linkend="ref.zlib">zlib</link> extension is not enabled. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar-&gt;uncompressAllFiles</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->compressAllFilesGZ(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } $p->uncompressAllFiles(); foreach ($p as $file) { var_dump($file->getFileName()); var_dump($file->isCompressed()); var_dump($file->isCompressedBZIP2()); var_dump($file->isCompressedGZ()); } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ string(10) "myfile.txt" bool(true) bool(false) bool(true) string(11) "myfile2.txt" bool(true) 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><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedbzip2"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-setuncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-compressallfilesbzip2"><function>Phar-&gt;compressAllFilesBZIP2</function></link></member> <member><link linkend="function.phar-compressallfilesgz"><function>Phar-&gt;compressAllFilesGZ</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-construct.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-construct.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-construct.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-construct"> <refnamediv> <refname>PharFileInfo::__construct</refname> <refpurpose>Construct a Phar entry object</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>PharFileInfo::__construct</methodname> <methodparam><type>string</type><parameter>entry</parameter></methodparam> </methodsynopsis> <para> This should not be called directly. Instead, a PharFileInfo object is initialized by calling <function>Phar::offsetGet</function> through array access. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>entry</parameter></term> <listitem> <para> The full url to retrieve a file. If you wish to retrieve the information for the file <literal>my/file.php</literal> from the phar <literal>boo.phar</literal>, the entry should be <literal>phar://boo.phar/my/file.php</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if <function>__construct</function> is called twice. Throws <classname>UnexpectedValueException</classname> if the phar URL requested is malformed, the requested phar cannot be opened, or the file can't be found within the phar. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo::__construct</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['testfile.txt'] = "hi\nthere\ndude"; $file = $p['testfile.txt']; foreach ($file as $line => $text) { echo "line number $line: $text"; } // this also works $file = new PharFileInfo('phar:///path/to/my.phar/testfile.txt'); foreach ($file as $line => $text) { echo "line number $line: $text"; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ line number 1: hi line number 2: there line number 3: dude line number 1: hi line number 2: there line number 3: dude ]]> </screen> </example> </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-getcompressedsize.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-getcompressedsize.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-getcompressedsize.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-getcompressedsize"> <refnamediv> <refname>PharFileInfo-&gt;getCompressedSize</refname> <refpurpose>Returns the actual size of the file (with compression) inside the Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo-&gt;getCompressedSize</methodname> <void/> </methodsynopsis> <para> This returns the size of the file within the Phar archive. Uncompressed files will return the same value for getCompressedSize as they will with <function>filesize</function> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The size in bytes of the file within the Phar archive on disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;getCompressedSize</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; echo $file->getCompressedSize(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ 2 ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;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-getcrc32.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-getcrc32.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-getcrc32.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-getcrc32"> <refnamediv> <refname>PharFileInfo-&gt;getCRC32</refname> <refpurpose>Returns CRC32 code or throws an exception if not CRC checked</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo-&gt;getCRC32</methodname> <void/> </methodsynopsis> <para> This returns the <function>crc32</function> checksum of the file within the Phar archive. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The <function>crc32</function> checksum of the file within the Phar archive. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>BadMethodCallException</classname> if the file has not yet had its CRC32 verified. This should be impossible with normal use, as the CRC is verified upon opening the file for reading or writing. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;getCRC32</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; echo $file->getCRC32(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ 3633523372 ]]> </screen> </example> </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-&gt;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-&gt;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-&gt;getMetaData</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'); } 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-&gt;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-getpharflags.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-getpharflags.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-getpharflags.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-getPharFlags"> <refnamediv> <refname>PharFileInfo-&gt;getPharFlags</refname> <refpurpose>Returns the Phar file entry flags</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharFileInfo-&gt;getPharFlags</methodname> <void/> </methodsynopsis> <para> This returns the size of the file within the Phar archive. Uncompressed files will return the same value for getCompressedSize as they will with <function>filesize</function> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The size in bytes of the file within the Phar archive on disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;getPharFlags</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->getPharFlags()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ int(0) ]]> </screen> </example> </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-iscompressed.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-iscompressed.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-iscompressed.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-iscompressed"> <refnamediv> <refname>PharFileInfo-&gt;isCompressed</refname> <refpurpose>Returns whether the entry is compressed</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo-&gt;isCompressed</methodname> <void/> </methodsynopsis> <para> This returns whether a file is compressed within a Phar archive with either Gzip or Bzip2 compression. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if the file is compressed within the Phar archive, &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;isCompressed</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressed()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-getcompressedsize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedBZIP2</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-iscompressedbzip2.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-iscompressedbzip2.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-iscompressedbzip2.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-iscompressedbzip2"> <refnamediv> <refname>PharFileInfo-&gt;isCompressedBZIP2</refname> <refpurpose>Returns whether the entry is compressed using bzip2</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo-&gt;isCompressedBZIP2</methodname> <void/> </methodsynopsis> <para> This returns whether a file is compressed within a Phar archive with Bzip2 compression. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if the file is compressed within the Phar archive using Bzip2, &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;isCompressedBZIP2</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedBZIP2()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-getcompressedsize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;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-iscompressedgz.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-iscompressedgz.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-iscompressedgz.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-iscompressedgz"> <refnamediv> <refname>PharFileInfo-&gt;isCompressedGZ</refname> <refpurpose>Returns whether the entry is compressed using gz</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo-&gt;isCompressedGZ</methodname> <void/> </methodsynopsis> <para> This returns whether a file is compressed within a Phar archive with Gzip compression. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if the file is compressed within the Phar archive using Gzip, &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;isCompressedGZ</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCompressedGZ()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(false) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="function.pharfileinfo-getcompressedsize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;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-iscrcchecked.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/functions/pharfileinfo-iscrcchecked.xml +++ phpdoc/en/reference/phar/functions/pharfileinfo-iscrcchecked.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.pharfileinfo-iscrcchecked"> <refnamediv> <refname>PharFileInfo-&gt;isCRCChecked</refname> <refpurpose>Returns whether file entry has had its CRC verified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharFileInfo-&gt;isCRCChecked</methodname> <void/> </methodsynopsis> <para> This returns whether a file within a Phar archive has had its CRC verified. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &true; if the file has had its CRC verified, &false; if not. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharFileInfo-&gt;isCRCChecked</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, 'my.phar'); $p['myfile.txt'] = 'hi'; $file = $p['myfile.txt']; var_dump($file->isCRCChecked()); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bool(true) ]]> </screen> </example> </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-&gt;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-&gt;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-&gt;setCompressedBZIP2</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, '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-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-setuncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-compressallfilesbzip2"><function>Phar-&gt;compressAllFilesBZIP2</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-&gt;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-&gt;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-&gt;setCompressedGZ</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, '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-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member> <member><link linkend="function.pharfileinfo-iscompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedbzip2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member> <member><link linkend="function.pharfileinfo-setuncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-compressallfilesgz"><function>Phar-&gt;compressAllFilesGZ</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-&gt;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-&gt;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-&gt;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'); } 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-&gt;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-&gt;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-&gt;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-&gt;setUncompressed</function> example</title> <programlisting role="php"> <![CDATA[ <?php $p = new Phar('/path/to/my.phar', 0, '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-&gt;getCompressedSize</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-iscompressedbzip2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedgz"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member> <member><link linkend="function.pharfileinfo-setcompressedbzip2"><function>PharFileInfo-&gt;isCompressed</function></link></member> <member><link linkend="function.phar-uncompressallfiles"><function>Phar-&gt;uncompressAllFiles</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 -->
« previous php.doc (#969375186) next »