cvs: phpdoc /en language-snippets.ent /en/reference/phar/Phar addEmptyDir.xml addFile.xml addFromString.xml buildFromDirectory.xml canWrite.xml
delete.xml extractTo.xml getExtractList.xml interceptFileFuncs.xml isCompressed.xml isValidPharFilename.xml isWritable.xml mount.xml running.xml
setDefaultStub.xml /en/reference/phar/PharData addEmptyDir.xml addFile.xml addFromString.xml buildFromDirectory.xml delete.xml extractTo.xml
isWritable.xml setDefaultStub.xml
| From: | Greg Beaver | Date: | Fri, 02 May 2008 04:36:22 +0000 |
| Subject: | cvs: phpdoc /en language-snippets.ent /en/reference/phar/Phar addEmptyDir.xml addFile.xml addFromString.xml buildFromDirectory.xml canWrite.xml delete.xml extractTo.xml getExtractList.xml interceptFileFuncs.xml isCompressed.xml isValidPharFilename.xml isWritable.xml mount.xml running.xml setDefaultStub.xml /en/reference/phar/PharData addEmptyDir.xml addFile.xml addFromString.xml buildFromDirectory.xml delete.xml extractTo.xml isWritable.xml setDefaultStub.xml |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-1580@lists.php.net to get a copy of this message | ||
cellog Fri May 2 04:36:22 2008 UTC
Added files:
/phpdoc/en/reference/phar/Phar delete.xml extractTo.xml
getExtractList.xml isWritable.xml
mount.xml running.xml
setDefaultStub.xml
/phpdoc/en/reference/phar/PharData buildFromDirectory.xml
delete.xml extractTo.xml
isWritable.xml
setDefaultStub.xml
Modified files:
/phpdoc/en language-snippets.ent
/phpdoc/en/reference/phar/Phar addEmptyDir.xml addFile.xml
addFromString.xml
buildFromDirectory.xml canWrite.xml
interceptFileFuncs.xml
isCompressed.xml
isValidPharFilename.xml
/phpdoc/en/reference/phar/PharData addEmptyDir.xml addFile.xml
addFromString.xml
Log:
docs now match CVS of pecl/phar
http://cvs.php.net/viewvc.cgi/phpdoc/en/language-snippets.ent?r1=1.221&r2=1.222&diff_format=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.221 phpdoc/en/language-snippets.ent:1.222 --- phpdoc/en/language-snippets.ent:1.221 Sat Apr 26 17:18:02 2008 +++ phpdoc/en/language-snippets.ent Fri May 2 04:36:21 2008 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.221 $ --> +<!-- $Revision: 1.222 $ --> <!-- Keep 'em sorted --> @@ -927,3 +927,13 @@ set to <literal>0</literal> in order to work for <classname>Phar</classname> objects. Otherwise, a <classname>PharException</classname> will be thrown.</para></note>'> +<!ENTITY phar.removed.pharcompress '<note xmlns="http://docbook.org/ns/docbook"><para>This +method has been removed from the phar extension as of version 2.0.0. Alternative +implementations are available using <function>Phar::compress</function>, +<function>Phar::decompress</function>, <function>Phar::compressFiles</function> and +<function>Phar::decompressFiles</function>.</para></note>'> + +<!ENTITY phar.removed.pharfileinfocompress '<note xmlns="http://docbook.org/ns/docbook"><para>This +method has been removed from the phar extension as of version 2.0.0. Alternative +implementations are available using <function>PharFileInfo::isCompressed</function>, +<function>PharFileInfo::decompress</function>, and <function>PharFileInfo::compress</function>.</para></note>'> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addEmptyDir.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addEmptyDir.xml diff -u phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.1 phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.2 --- phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addEmptyDir.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addemptydir"> <refnamediv> <refname>Phar::addEmptyDir</refname> @@ -14,7 +14,8 @@ &phar.write; <para> - With this method, an empty directory is created with path <literal>dirname</literal> + With this method, an empty directory is created with path <literal>dirname</literal>. + This method is similar to <function>ZipArchive::addEmptyDir</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addFile.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addFile.xml diff -u phpdoc/en/reference/phar/Phar/addFile.xml:1.1 phpdoc/en/reference/phar/Phar/addFile.xml:1.2 --- phpdoc/en/reference/phar/Phar/addFile.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addFile.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfile"> <refnamediv> <refname>Phar::addFile</refname> @@ -20,6 +20,7 @@ the file will be stored in the archive with that name, otherwise the <literal>file</literal> parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. + This method is similar to <function>ZipArchive::addFile</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addFromString.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addFromString.xml diff -u phpdoc/en/reference/phar/Phar/addFromString.xml:1.1 phpdoc/en/reference/phar/Phar/addFromString.xml:1.2 --- phpdoc/en/reference/phar/Phar/addFromString.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addFromString.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfromstring"> <refnamediv> <refname>Phar::addFromString</refname> @@ -17,7 +17,7 @@ <para> With this method, any string can be added to the phar archive. The file will be stored in the archive with <literal>localname</literal> as its - path. + path. This method is similar to <function>ZipArchive::addFromString</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromDirectory.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/buildFromDirectory.xml diff -u phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.1 phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.2 --- phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.1 Thu May 1 03:28:07 2008 +++ phpdoc/en/reference/phar/Phar/buildFromDirectory.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xml:id="phar.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromDirectory</refname> @@ -15,39 +15,12 @@ </methodsynopsis> &phar.write; <para> - Populate a phar archive from a directory contents. The optional second + Populate a phar archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>Phar::buildFromIterator</function>. </para> </refsect1> - <refsect1 role="examples"> - &reftitle.examples; - <example> - <title>A <function>Phar::buildFromDirectory</function> example</title> - <para> - - </para> - <para> - <programlisting role="php"> - <![CDATA[ -<?php -// create with alias "project.phar" -$phar = new Phar('project.phar', 0, 'project.phar'); -// add all files in the project -$phar->buildFromDirectory(dirname(__FILE__) . '/project'); -$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); - -$phar2 = new Phar('project2.phar', 0, 'project2.phar'); -// add all files in the project, only include php files -$phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); -$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); -?> - ]]> - </programlisting> - </para> - </example> - </refsect1> <refsect1 role="parameters"> &reftitle.parameters; @@ -95,6 +68,34 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>A <function>Phar::buildFromDirectory</function> example</title> + <para> + + </para> + <para> + <programlisting role="php"> + <![CDATA[ +<?php +// create with alias "project.phar" +$phar = new Phar('project.phar', 0, 'project.phar'); +// add all files in the project +$phar->buildFromDirectory(dirname(__FILE__) . '/project'); +$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); + +$phar2 = new Phar('project2.phar', 0, 'project2.phar'); +// add all files in the project, only include php files +$phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); +$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); +?> + ]]> + </programlisting> + </para> + </example> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/canWrite.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/canWrite.xml diff -u phpdoc/en/reference/phar/Phar/canWrite.xml:1.2 phpdoc/en/reference/phar/Phar/canWrite.xml:1.3 --- phpdoc/en/reference/phar/Phar/canWrite.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/canWrite.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.canwrite"> <refnamediv> <refname>Phar::canWrite</refname> @@ -13,7 +13,7 @@ </methodsynopsis> <para> - This method determines whether write access has been disabled in + This static 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> @@ -54,6 +54,7 @@ <para> <simplelist> <member><link linkend="ini.phar.readonly">phar.readonly</link></member> + <member><function>Phar::isWritable</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml diff -u phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.2 phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.3 --- phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.interceptfilefuncs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::interceptFileFuncs</refname> @@ -13,7 +13,7 @@ <void/> </methodsynopsis> <para> - instructs phar to intercept <function>fopen</function>, + instructs phar to intercept <function>fopen</function>, <function>readfile</function>, <function>file_get_contents</function>, <function>opendir</function>, and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isCompressed.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/phar/Phar/isCompressed.xml diff -u phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 phpdoc/en/reference/phar/Phar/isCompressed.xml:1.5 --- phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 Thu May 1 03:28:07 2008 +++ phpdoc/en/reference/phar/Phar/isCompressed.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xml:id="phar.iscompressed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isCompressed</refname> @@ -17,7 +17,7 @@ <para> Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on). Zip-based phar archives cannot be compressed as a - file, and so this method will always return &false; if a zip-based archive is queried. + file, and so this method will always return &false; if a zip-based phar archive is queried. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isValidPharFilename.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isValidPharFilename.xml diff -u phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.2 phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.3 --- phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isValidPharFilename.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.isvalidpharfilename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isValidPharFilename</refname> @@ -11,6 +11,7 @@ <methodsynopsis> <type>bool</type><methodname>Phar::isValidPharFilename</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>executable</parameter></methodparam> </methodsynopsis> <para> @@ -29,6 +30,17 @@ <term><parameter>filename</parameter></term> <listitem> <para> + The name or full path to a phar archive not yet created + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>executable</parameter></term> + <listitem> + <para> + This parameter determines whether the filename should be treated as + a phar executable archive, or a data non-executable archive and is + &true; by default </para> </listitem> </varlistentry> @@ -39,7 +51,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns &true; if the filename is valid. + Returns &true; if the filename is valid, &false; if not. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addEmptyDir.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addEmptyDir.xml diff -u phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.1 phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.2 --- phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addEmptyDir.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addemptydir"> <refnamediv> <refname>PharData::addEmptyDir</refname> @@ -13,7 +13,8 @@ </methodsynopsis> <para> - With this method, an empty directory is created with path <literal>dirname</literal> + With this method, an empty directory is created with path <literal>dirname</literal>. + This method is similar to <function>ZipArchive::addEmptyDir</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addFile.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addFile.xml diff -u phpdoc/en/reference/phar/PharData/addFile.xml:1.1 phpdoc/en/reference/phar/PharData/addFile.xml:1.2 --- phpdoc/en/reference/phar/PharData/addFile.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addFile.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfile"> <refnamediv> <refname>PharData::addFile</refname> @@ -19,6 +19,7 @@ the file will be stored in the archive with that name, otherwise the <literal>file</literal> parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. + This method is similar to <function>ZipArchive::addFile</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addFromString.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addFromString.xml diff -u phpdoc/en/reference/phar/PharData/addFromString.xml:1.1 phpdoc/en/reference/phar/PharData/addFromString.xml:1.2 --- phpdoc/en/reference/phar/PharData/addFromString.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addFromString.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfromstring"> <refnamediv> <refname>PharData::addFromString</refname> @@ -16,7 +16,7 @@ <para> With this method, any string can be added to the tar/zip archive. The file will be stored in the archive with <literal>localname</literal> as its - path. + path. This method is similar to <function>ZipArchive::addFromString</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/delete.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/delete.xml +++ phpdoc/en/reference/phar/Phar/delete.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::delete</refname> <refpurpose>Delete a file within a phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar::delete</methodname> <methodparam><type>string</type><parameter>entry</parameter></methodparam> </methodsynopsis> &phar.write; <para> Delete a file within an archive. This is the functional equivalent of calling <function>unlink</function> on the stream wrapper equivalent, as shown in the example below. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>entry</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::delete</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->delete('unlink/me.php'); // this is equivalent to: unlink('phar://myphar.phar/unlink/me.php'); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharData::delete</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/extractTo.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/extractTo.xml +++ phpdoc/en/reference/phar/Phar/extractTo.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.extractto" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::extractTo</refname> <refpurpose>Extract the contents of a phar archive to a directory</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar::extractTo</methodname> <methodparam><type>string</type><parameter>pathto</parameter></methodparam> <methodparam choice="opt"><type>string|array</type><parameter>files</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>overwrite</parameter></methodparam> </methodsynopsis> &phar.write; <para> Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter <literal>files</literal> can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to <function>ZipArchive::extractTo</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pathto</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>files</parameter></term> <listitem> <para> The name of a file or directory to extract, or an array of files/directories to extract </para> </listitem> </varlistentry> <varlistentry> <term><parameter>overwrite</parameter></term> <listitem> <para> &false; by default, set to &true; to enable overwriting existing files </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::extractTo</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->extractTo('/full/path'); // extract all files $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt $phar->extractTo('/this/path', array('file1.txt', 'file2.txt')); // extract 2 files only $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharData::extractTo</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/getExtractList.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/getExtractList.xml +++ phpdoc/en/reference/phar/Phar/getExtractList.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="phar.getextractlist"> <refnamediv> <refname>Phar::getExtractList</refname> <refpurpose>Retrieve phar.extract_list value</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar::getExtractList</methodname> <void /> </methodsynopsis> <para> This method can be used as an alternative to <function>ini_get</function> to retrieve the value of <literal>phar.extract_list</literal> in an environment where <function>ini_get</function> has been disabled by php.ini settings. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> no errors </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="ini.phar.extract-list">phar.extract_list</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/Phar/isWritable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/isWritable.xml +++ phpdoc/en/reference/phar/Phar/isWritable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.iswritable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isWritable</refname> <refpurpose>Returns true if the phar archive can be modified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::isWritable</methodname> <void/> </methodsynopsis> <para> This method returns &true; if <literal>phar.readonly</literal> is <literal>0</literal>, and the actual phar archive on disk is not read-only. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the phar archive can be modified </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::canWrite</function></member> <member><function>PharData::isWritable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/mount.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/mount.xml +++ phpdoc/en/reference/phar/Phar/mount.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.mount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::mount</refname> <refpurpose>Mount an external path or file to a virtual location within the phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::mount</methodname> <methodparam><type>string</type><parameter>pharpath</parameter></methodparam> <methodparam><type>string</type><parameter>externalpath</parameter></methodparam> </methodsynopsis> <para> Much like the unix file system concept of mounting external devices to paths within the directory tree, <function>Phar::mount</function> allows referring to external files and directories as if they were inside of an archive. This allows powerful abstraction such as referring to external configuration files as if they were inside the archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pharpath</parameter></term> <listitem> <para> The internal path within the phar archive to use as the mounted path location. If executed within a phar archive, this may be a relative path, otherwise this must be a full <literal>phar</literal> URL. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>externalpath</parameter></term> <listitem> <para> A path or URL to an external file or directory to mount within the phar archive </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> No return. <classname>PharException</classname> is thrown on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if any problems occur mounting the path. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::mount</function> example</title> <para> The following example shows accessing an external configuration file as if it were a path within a phar archive. </para> <para> First, the code inside of a phar archive: </para> <programlisting role="php"> <![CDATA[ <?php $configuration = simplexml_load_string(file_get_contents( Phar::running(false) . '/config.xml')); ?> ]]> </programlisting> <para> Next the external code used to mount the configuration file: </para> <programlisting role="php"> <![CDATA[ <?php // first set up the association between the abstract config.xml // and the actual one on disk Phar::mount('phar:///path/to/archive.phar/config.xml', '/home/example/config.xml'); // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> <para> Another method is to put the mounting code inside the stub of the phar archive. Here is an example of setting up a default configuration file if no user configuration is specified: </para> <programlisting role="php"> <![CDATA[ <?php // first set up the association between the abstract config.xml // and the actual one on disk if (defined('EXTERNAL_CONFIG')) { Phar::mount('config.xml', EXTERNAL_CONFIG); } else { Phar::mount('config.xml', Phar::running(false) . '/default_config.xml'); } // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> <para> ...and the code externally to load this phar archive: </para> <programlisting role="php"> <![CDATA[ <?php define('EXTERNAL_CONFIG', '/home/example/config.xml'); // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> </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/Phar/running.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/running.xml +++ phpdoc/en/reference/phar/Phar/running.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.running" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::running</refname> <refpurpose>Returns the full path on disk or full phar URL to the currently executing Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::running</methodname> <methodparam choice="opt"><type>bool</type><parameter>retphar</parameter></methodparam> </methodsynopsis> <para> Returns the full path to the running phar archive. This is intended for use much like the <literal>__FILE__</literal> magic constant, and only has effect inside an executing phar archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>retphar</parameter></term> <listitem> <para> &true; by default. If &true;, the full path on disk to the phar archive is returned. If &false;, a full phar URL is returned. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the filename is valid. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::running</function> example</title> <para> For the following example, assume the file is within phar archive <literal>/path/to/phar/my.phar</literal> and the file is located at path <literal>my/file.txt</literal> within the phar archive. </para> <programlisting role="php"> <![CDATA[ <?php $a = Phar::running(); // $a is "/path/to/my.phar" $b = Phar::running(false); // $b is "phar:///path/to/my.phar" ?> ]]> </programlisting> </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/Phar/setDefaultStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/setDefaultStub.xml +++ phpdoc/en/reference/phar/Phar/setDefaultStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.setdefaultstub"> <refnamediv> <refname>Phar::setDefaultStub</refname> <refpurpose>Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::setDefaultStub</methodname> <methodparam choice="opt"><type>string</type><parameter>index</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>webindex</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is a convenience method that combines the functionality of <function>Phar::createDefaultStub</function> and <function>Phar::setStub</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>index</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed on the command-line </para> </listitem> </varlistentry> <varlistentry> <term><parameter>webindex</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed through a web browser </para> </listitem> </varlistentry> </variablelist> </para> </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::setDefaultStub</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->setDefaultStub('cli.php', 'web/index.php'); // this is the same as: // $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::setStub</function></member> <member><function>Phar::createDefaultStub</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/buildFromDirectory.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/buildFromDirectory.xml +++ phpdoc/en/reference/phar/PharData/buildFromDirectory.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::buildFromDirectory</refname> <refpurpose>Construct a tar/zip archive from the files within a directory.</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::buildFromDirectory</methodname> <methodparam><type>string</type><parameter>base_dir</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>regex</parameter></methodparam> </methodsynopsis> <para> Populate a tar/zip archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>PharData::buildFromIterator</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>base_dir</parameter></term> <listitem> <para> The full or relative path to the directory that contains all files to add to the archive. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>regex</parameter></term> <listitem> <para> An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> <function>Phar::buildFromDirectory</function> returns an associative array mapping internal path of file to the full path of the file on the filesystem. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to instantiate the internal directory iterators, or a <classname>PharException</classname> if there were errors saving the phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>A <function>PharData::buildFromDirectory</function> example</title> <para> </para> <para> <programlisting role="php"> <![CDATA[ <?php $phar = new PharData('project.tar'); // add all files in the project $phar->buildFromDirectory(dirname(__FILE__) . '/project'); $phar2 = new PharData('project2.zip'); // add all files in the project, only include php files $phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); ?> ]]> </programlisting> </para> </example> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::buildFromDirectory</function></member> <member><function>PharData::buildFromIterator</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/delete.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/delete.xml +++ phpdoc/en/reference/phar/PharData/delete.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::delete</refname> <refpurpose>Delete a file within a tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharData::delete</methodname> <methodparam><type>string</type><parameter>entry</parameter></methodparam> </methodsynopsis> <para> Delete a file within an archive. This is the functional equivalent of calling <function>unlink</function> on the stream wrapper equivalent, as shown in the example below. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>entry</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::delete</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new PharData('myphar.zip'); $phar->delete('unlink/me.php'); // this is equivalent to: unlink('phar://myphar.phar/unlink/me.php'); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::delete</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/extractTo.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/extractTo.xml +++ phpdoc/en/reference/phar/PharData/extractTo.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.extractto" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::extractTo</refname> <refpurpose>Extract the contents of a tar/zip archive to a directory</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharData::extractTo</methodname> <methodparam><type>string</type><parameter>pathto</parameter></methodparam> <methodparam choice="opt"><type>string|array</type><parameter>files</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>overwrite</parameter></methodparam> </methodsynopsis> <para> Extract all files within a tar/zip archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter <literal>files</literal> can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to <function>ZipArchive::extractTo</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pathto</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>files</parameter></term> <listitem> <para> The name of a file or directory to extract, or an array of files/directories to extract </para> </listitem> </varlistentry> <varlistentry> <term><parameter>overwrite</parameter></term> <listitem> <para> &false; by default, set to &true; to enable overwriting existing files </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::extractTo</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new PharData('myphar.tar'); $phar->extractTo('/full/path'); // extract all files $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt $phar->extractTo('/this/path', array('file1.txt', 'file2.txt')); // extract 2 files only $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::extractTo</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/isWritable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/isWritable.xml +++ phpdoc/en/reference/phar/PharData/isWritable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.iswritable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::isWritable</refname> <refpurpose>Returns true if the tar/zip archive can be modified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::isWritable</methodname> <void/> </methodsynopsis> <para> This method returns &true; if the tar/zip archive on disk is not read-only. Unlike <function>Phar::isWritable</function>, data-only tar/zip archives can be modified even if <literal>phar.readonly</literal> is set to <literal>1</literal>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the tar/zip archive can be modified </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::canWrite</function></member> <member><function>Phar::isWritable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setDefaultStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setDefaultStub.xml +++ phpdoc/en/reference/phar/PharData/setDefaultStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.setdefaultstub"> <refnamediv> <refname>PharData::setDefaultStub</refname> <refpurpose>dummy function (Phar::setDefaultStub is not valid for PharData)</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>PharData::setDefaultStub</methodname> <methodparam choice="opt"><type>string</type><parameter>index</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>webindex</parameter></methodparam> </methodsynopsis> <para> Non-executable tar/zip archives cannot have a stub, so this method simply throws an exception. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>index</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed on the command-line </para> </listitem> </varlistentry> <varlistentry> <term><parameter>webindex</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed through a web browser </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> on all method calls </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::setDefaultStub</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/language-snippets.ent?r1=1.221&r2=1.222&diff_format=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.221 phpdoc/en/language-snippets.ent:1.222 --- phpdoc/en/language-snippets.ent:1.221 Sat Apr 26 17:18:02 2008 +++ phpdoc/en/language-snippets.ent Fri May 2 04:36:21 2008 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.221 $ --> +<!-- $Revision: 1.222 $ --> <!-- Keep 'em sorted --> @@ -927,3 +927,13 @@ set to <literal>0</literal> in order to work for <classname>Phar</classname> objects. Otherwise, a <classname>PharException</classname> will be thrown.</para></note>'> +<!ENTITY phar.removed.pharcompress '<note xmlns="http://docbook.org/ns/docbook"><para>This +method has been removed from the phar extension as of version 2.0.0. Alternative +implementations are available using <function>Phar::compress</function>, +<function>Phar::decompress</function>, <function>Phar::compressFiles</function> and +<function>Phar::decompressFiles</function>.</para></note>'> + +<!ENTITY phar.removed.pharfileinfocompress '<note xmlns="http://docbook.org/ns/docbook"><para>This +method has been removed from the phar extension as of version 2.0.0. Alternative +implementations are available using <function>PharFileInfo::isCompressed</function>, +<function>PharFileInfo::decompress</function>, and <function>PharFileInfo::compress</function>.</para></note>'> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addEmptyDir.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addEmptyDir.xml diff -u phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.1 phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.2 --- phpdoc/en/reference/phar/Phar/addEmptyDir.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addEmptyDir.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addemptydir"> <refnamediv> <refname>Phar::addEmptyDir</refname> @@ -14,7 +14,8 @@ &phar.write; <para> - With this method, an empty directory is created with path <literal>dirname</literal> + With this method, an empty directory is created with path <literal>dirname</literal>. + This method is similar to <function>ZipArchive::addEmptyDir</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addFile.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addFile.xml diff -u phpdoc/en/reference/phar/Phar/addFile.xml:1.1 phpdoc/en/reference/phar/Phar/addFile.xml:1.2 --- phpdoc/en/reference/phar/Phar/addFile.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addFile.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfile"> <refnamediv> <refname>Phar::addFile</refname> @@ -20,6 +20,7 @@ the file will be stored in the archive with that name, otherwise the <literal>file</literal> parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. + This method is similar to <function>ZipArchive::addFile</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/addFromString.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/addFromString.xml diff -u phpdoc/en/reference/phar/Phar/addFromString.xml:1.1 phpdoc/en/reference/phar/Phar/addFromString.xml:1.2 --- phpdoc/en/reference/phar/Phar/addFromString.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/Phar/addFromString.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.addfromstring"> <refnamediv> <refname>Phar::addFromString</refname> @@ -17,7 +17,7 @@ <para> With this method, any string can be added to the phar archive. The file will be stored in the archive with <literal>localname</literal> as its - path. + path. This method is similar to <function>ZipArchive::addFromString</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/buildFromDirectory.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/Phar/buildFromDirectory.xml diff -u phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.1 phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.2 --- phpdoc/en/reference/phar/Phar/buildFromDirectory.xml:1.1 Thu May 1 03:28:07 2008 +++ phpdoc/en/reference/phar/Phar/buildFromDirectory.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xml:id="phar.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::buildFromDirectory</refname> @@ -15,39 +15,12 @@ </methodsynopsis> &phar.write; <para> - Populate a phar archive from a directory contents. The optional second + Populate a phar archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>Phar::buildFromIterator</function>. </para> </refsect1> - <refsect1 role="examples"> - &reftitle.examples; - <example> - <title>A <function>Phar::buildFromDirectory</function> example</title> - <para> - - </para> - <para> - <programlisting role="php"> - <![CDATA[ -<?php -// create with alias "project.phar" -$phar = new Phar('project.phar', 0, 'project.phar'); -// add all files in the project -$phar->buildFromDirectory(dirname(__FILE__) . '/project'); -$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); - -$phar2 = new Phar('project2.phar', 0, 'project2.phar'); -// add all files in the project, only include php files -$phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); -$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); -?> - ]]> - </programlisting> - </para> - </example> - </refsect1> <refsect1 role="parameters"> &reftitle.parameters; @@ -95,6 +68,34 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>A <function>Phar::buildFromDirectory</function> example</title> + <para> + + </para> + <para> + <programlisting role="php"> + <![CDATA[ +<?php +// create with alias "project.phar" +$phar = new Phar('project.phar', 0, 'project.phar'); +// add all files in the project +$phar->buildFromDirectory(dirname(__FILE__) . '/project'); +$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); + +$phar2 = new Phar('project2.phar', 0, 'project2.phar'); +// add all files in the project, only include php files +$phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); +$phar->setStub($phar->createDefaultWebStub('cli/index.php', 'www/index.php')); +?> + ]]> + </programlisting> + </para> + </example> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/canWrite.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/canWrite.xml diff -u phpdoc/en/reference/phar/Phar/canWrite.xml:1.2 phpdoc/en/reference/phar/Phar/canWrite.xml:1.3 --- phpdoc/en/reference/phar/Phar/canWrite.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/canWrite.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.canwrite"> <refnamediv> <refname>Phar::canWrite</refname> @@ -13,7 +13,7 @@ </methodsynopsis> <para> - This method determines whether write access has been disabled in + This static 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> @@ -54,6 +54,7 @@ <para> <simplelist> <member><link linkend="ini.phar.readonly">phar.readonly</link></member> + <member><function>Phar::isWritable</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml diff -u phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.2 phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.3 --- phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/interceptFileFuncs.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.interceptfilefuncs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::interceptFileFuncs</refname> @@ -13,7 +13,7 @@ <void/> </methodsynopsis> <para> - instructs phar to intercept <function>fopen</function>, + instructs phar to intercept <function>fopen</function>, <function>readfile</function>, <function>file_get_contents</function>, <function>opendir</function>, and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isCompressed.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/phar/Phar/isCompressed.xml diff -u phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 phpdoc/en/reference/phar/Phar/isCompressed.xml:1.5 --- phpdoc/en/reference/phar/Phar/isCompressed.xml:1.4 Thu May 1 03:28:07 2008 +++ phpdoc/en/reference/phar/Phar/isCompressed.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xml:id="phar.iscompressed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isCompressed</refname> @@ -17,7 +17,7 @@ <para> Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on). Zip-based phar archives cannot be compressed as a - file, and so this method will always return &false; if a zip-based archive is queried. + file, and so this method will always return &false; if a zip-based phar archive is queried. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/isValidPharFilename.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/phar/Phar/isValidPharFilename.xml diff -u phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.2 phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.3 --- phpdoc/en/reference/phar/Phar/isValidPharFilename.xml:1.2 Mon Jan 21 21:54:18 2008 +++ phpdoc/en/reference/phar/Phar/isValidPharFilename.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="phar.isvalidpharfilename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isValidPharFilename</refname> @@ -11,6 +11,7 @@ <methodsynopsis> <type>bool</type><methodname>Phar::isValidPharFilename</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>executable</parameter></methodparam> </methodsynopsis> <para> @@ -29,6 +30,17 @@ <term><parameter>filename</parameter></term> <listitem> <para> + The name or full path to a phar archive not yet created + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>executable</parameter></term> + <listitem> + <para> + This parameter determines whether the filename should be treated as + a phar executable archive, or a data non-executable archive and is + &true; by default </para> </listitem> </varlistentry> @@ -39,7 +51,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns &true; if the filename is valid. + Returns &true; if the filename is valid, &false; if not. </para> </refsect1> </refentry> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addEmptyDir.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addEmptyDir.xml diff -u phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.1 phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.2 --- phpdoc/en/reference/phar/PharData/addEmptyDir.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addEmptyDir.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addemptydir"> <refnamediv> <refname>PharData::addEmptyDir</refname> @@ -13,7 +13,8 @@ </methodsynopsis> <para> - With this method, an empty directory is created with path <literal>dirname</literal> + With this method, an empty directory is created with path <literal>dirname</literal>. + This method is similar to <function>ZipArchive::addEmptyDir</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addFile.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addFile.xml diff -u phpdoc/en/reference/phar/PharData/addFile.xml:1.1 phpdoc/en/reference/phar/PharData/addFile.xml:1.2 --- phpdoc/en/reference/phar/PharData/addFile.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addFile.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfile"> <refnamediv> <refname>PharData::addFile</refname> @@ -19,6 +19,7 @@ the file will be stored in the archive with that name, otherwise the <literal>file</literal> parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. + This method is similar to <function>ZipArchive::addFile</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/addFromString.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/phar/PharData/addFromString.xml diff -u phpdoc/en/reference/phar/PharData/addFromString.xml:1.1 phpdoc/en/reference/phar/PharData/addFromString.xml:1.2 --- phpdoc/en/reference/phar/PharData/addFromString.xml:1.1 Thu May 1 05:02:08 2008 +++ phpdoc/en/reference/phar/PharData/addFromString.xml Fri May 2 04:36:22 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.addfromstring"> <refnamediv> <refname>PharData::addFromString</refname> @@ -16,7 +16,7 @@ <para> With this method, any string can be added to the tar/zip archive. The file will be stored in the archive with <literal>localname</literal> as its - path. + path. This method is similar to <function>ZipArchive::addFromString</function>. </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/delete.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/delete.xml +++ phpdoc/en/reference/phar/Phar/delete.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::delete</refname> <refpurpose>Delete a file within a phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar::delete</methodname> <methodparam><type>string</type><parameter>entry</parameter></methodparam> </methodsynopsis> &phar.write; <para> Delete a file within an archive. This is the functional equivalent of calling <function>unlink</function> on the stream wrapper equivalent, as shown in the example below. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>entry</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::delete</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->delete('unlink/me.php'); // this is equivalent to: unlink('phar://myphar.phar/unlink/me.php'); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharData::delete</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/extractTo.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/extractTo.xml +++ phpdoc/en/reference/phar/Phar/extractTo.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.extractto" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::extractTo</refname> <refpurpose>Extract the contents of a phar archive to a directory</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>Phar::extractTo</methodname> <methodparam><type>string</type><parameter>pathto</parameter></methodparam> <methodparam choice="opt"><type>string|array</type><parameter>files</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>overwrite</parameter></methodparam> </methodsynopsis> &phar.write; <para> Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter <literal>files</literal> can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to <function>ZipArchive::extractTo</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pathto</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>files</parameter></term> <listitem> <para> The name of a file or directory to extract, or an array of files/directories to extract </para> </listitem> </varlistentry> <varlistentry> <term><parameter>overwrite</parameter></term> <listitem> <para> &false; by default, set to &true; to enable overwriting existing files </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::extractTo</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->extractTo('/full/path'); // extract all files $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt $phar->extractTo('/this/path', array('file1.txt', 'file2.txt')); // extract 2 files only $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>PharData::extractTo</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/getExtractList.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/getExtractList.xml +++ phpdoc/en/reference/phar/Phar/getExtractList.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="phar.getextractlist"> <refnamediv> <refname>Phar::getExtractList</refname> <refpurpose>Retrieve phar.extract_list value</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>Phar::getExtractList</methodname> <void /> </methodsynopsis> <para> This method can be used as an alternative to <function>ini_get</function> to retrieve the value of <literal>phar.extract_list</literal> in an environment where <function>ini_get</function> has been disabled by php.ini settings. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> no errors </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><link linkend="ini.phar.extract-list">phar.extract_list</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/Phar/isWritable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/isWritable.xml +++ phpdoc/en/reference/phar/Phar/isWritable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.iswritable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::isWritable</refname> <refpurpose>Returns true if the phar archive can be modified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::isWritable</methodname> <void/> </methodsynopsis> <para> This method returns &true; if <literal>phar.readonly</literal> is <literal>0</literal>, and the actual phar archive on disk is not read-only. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the phar archive can be modified </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::canWrite</function></member> <member><function>PharData::isWritable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/Phar/mount.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/mount.xml +++ phpdoc/en/reference/phar/Phar/mount.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.mount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::mount</refname> <refpurpose>Mount an external path or file to a virtual location within the phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::mount</methodname> <methodparam><type>string</type><parameter>pharpath</parameter></methodparam> <methodparam><type>string</type><parameter>externalpath</parameter></methodparam> </methodsynopsis> <para> Much like the unix file system concept of mounting external devices to paths within the directory tree, <function>Phar::mount</function> allows referring to external files and directories as if they were inside of an archive. This allows powerful abstraction such as referring to external configuration files as if they were inside the archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pharpath</parameter></term> <listitem> <para> The internal path within the phar archive to use as the mounted path location. If executed within a phar archive, this may be a relative path, otherwise this must be a full <literal>phar</literal> URL. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>externalpath</parameter></term> <listitem> <para> A path or URL to an external file or directory to mount within the phar archive </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> No return. <classname>PharException</classname> is thrown on failure. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if any problems occur mounting the path. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::mount</function> example</title> <para> The following example shows accessing an external configuration file as if it were a path within a phar archive. </para> <para> First, the code inside of a phar archive: </para> <programlisting role="php"> <![CDATA[ <?php $configuration = simplexml_load_string(file_get_contents( Phar::running(false) . '/config.xml')); ?> ]]> </programlisting> <para> Next the external code used to mount the configuration file: </para> <programlisting role="php"> <![CDATA[ <?php // first set up the association between the abstract config.xml // and the actual one on disk Phar::mount('phar:///path/to/archive.phar/config.xml', '/home/example/config.xml'); // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> <para> Another method is to put the mounting code inside the stub of the phar archive. Here is an example of setting up a default configuration file if no user configuration is specified: </para> <programlisting role="php"> <![CDATA[ <?php // first set up the association between the abstract config.xml // and the actual one on disk if (defined('EXTERNAL_CONFIG')) { Phar::mount('config.xml', EXTERNAL_CONFIG); } else { Phar::mount('config.xml', Phar::running(false) . '/default_config.xml'); } // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> <para> ...and the code externally to load this phar archive: </para> <programlisting role="php"> <![CDATA[ <?php define('EXTERNAL_CONFIG', '/home/example/config.xml'); // now run the application include '/path/to/archive.phar'; ?> ]]> </programlisting> </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/Phar/running.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/running.xml +++ phpdoc/en/reference/phar/Phar/running.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phar.running" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Phar::running</refname> <refpurpose>Returns the full path on disk or full phar URL to the currently executing Phar archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>Phar::running</methodname> <methodparam choice="opt"><type>bool</type><parameter>retphar</parameter></methodparam> </methodsynopsis> <para> Returns the full path to the running phar archive. This is intended for use much like the <literal>__FILE__</literal> magic constant, and only has effect inside an executing phar archive. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>retphar</parameter></term> <listitem> <para> &true; by default. If &true;, the full path on disk to the phar archive is returned. If &false;, a full phar URL is returned. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the filename is valid. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>Phar::running</function> example</title> <para> For the following example, assume the file is within phar archive <literal>/path/to/phar/my.phar</literal> and the file is located at path <literal>my/file.txt</literal> within the phar archive. </para> <programlisting role="php"> <![CDATA[ <?php $a = Phar::running(); // $a is "/path/to/my.phar" $b = Phar::running(false); // $b is "phar:///path/to/my.phar" ?> ]]> </programlisting> </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/Phar/setDefaultStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/Phar/setDefaultStub.xml +++ phpdoc/en/reference/phar/Phar/setDefaultStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.setdefaultstub"> <refnamediv> <refname>Phar::setDefaultStub</refname> <refpurpose>Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>Phar::setDefaultStub</methodname> <methodparam choice="opt"><type>string</type><parameter>index</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>webindex</parameter></methodparam> </methodsynopsis> &phar.write; <para> This method is a convenience method that combines the functionality of <function>Phar::createDefaultStub</function> and <function>Phar::setStub</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>index</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed on the command-line </para> </listitem> </varlistentry> <varlistentry> <term><parameter>webindex</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed through a web browser </para> </listitem> </varlistentry> </variablelist> </para> </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::setDefaultStub</function> example</title> <para> </para> <programlisting role="php"> <![CDATA[ <?php try { $phar = new Phar('myphar.phar'); $phar->setDefaultStub('cli.php', 'web/index.php'); // this is the same as: // $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::setStub</function></member> <member><function>Phar::createDefaultStub</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/buildFromDirectory.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/buildFromDirectory.xml +++ phpdoc/en/reference/phar/PharData/buildFromDirectory.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.buildfromdirectory" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::buildFromDirectory</refname> <refpurpose>Construct a tar/zip archive from the files within a directory.</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>Phar::buildFromDirectory</methodname> <methodparam><type>string</type><parameter>base_dir</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>regex</parameter></methodparam> </methodsynopsis> <para> Populate a tar/zip archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use <function>PharData::buildFromIterator</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>base_dir</parameter></term> <listitem> <para> The full or relative path to the directory that contains all files to add to the archive. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>regex</parameter></term> <listitem> <para> An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> <function>Phar::buildFromDirectory</function> returns an associative array mapping internal path of file to the full path of the file on the filesystem. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> This method throws <classname>BadMethodCallException</classname> when unable to instantiate the internal directory iterators, or a <classname>PharException</classname> if there were errors saving the phar archive. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> <title>A <function>PharData::buildFromDirectory</function> example</title> <para> </para> <para> <programlisting role="php"> <![CDATA[ <?php $phar = new PharData('project.tar'); // add all files in the project $phar->buildFromDirectory(dirname(__FILE__) . '/project'); $phar2 = new PharData('project2.zip'); // add all files in the project, only include php files $phar->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/'); ?> ]]> </programlisting> </para> </example> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::buildFromDirectory</function></member> <member><function>PharData::buildFromIterator</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/delete.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/delete.xml +++ phpdoc/en/reference/phar/PharData/delete.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::delete</refname> <refpurpose>Delete a file within a tar/zip archive</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharData::delete</methodname> <methodparam><type>string</type><parameter>entry</parameter></methodparam> </methodsynopsis> <para> Delete a file within an archive. This is the functional equivalent of calling <function>unlink</function> on the stream wrapper equivalent, as shown in the example below. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>entry</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::delete</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new PharData('myphar.zip'); $phar->delete('unlink/me.php'); // this is equivalent to: unlink('phar://myphar.phar/unlink/me.php'); } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::delete</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/extractTo.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/extractTo.xml +++ phpdoc/en/reference/phar/PharData/extractTo.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.extractto" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::extractTo</refname> <refpurpose>Extract the contents of a tar/zip archive to a directory</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>PharData::extractTo</methodname> <methodparam><type>string</type><parameter>pathto</parameter></methodparam> <methodparam choice="opt"><type>string|array</type><parameter>files</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>overwrite</parameter></methodparam> </methodsynopsis> <para> Extract all files within a tar/zip archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter <literal>files</literal> can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to <function>ZipArchive::extractTo</function>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pathto</parameter></term> <listitem> <para> Path within an archive to the file to delete. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>files</parameter></term> <listitem> <para> The name of a file or directory to extract, or an array of files/directories to extract </para> </listitem> </varlistentry> <varlistentry> <term><parameter>overwrite</parameter></term> <listitem> <para> &false; by default, set to &true; to enable overwriting existing files </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> returns &true; on success, but it is better to check for thrown exception, and assume success if none is thrown. </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> if errors occur while flushing changes to disk. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>PharData::extractTo</function> example</title> <programlisting role="php"> <![CDATA[ <?php try { $phar = new PharData('myphar.tar'); $phar->extractTo('/full/path'); // extract all files $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt $phar->extractTo('/this/path', array('file1.txt', 'file2.txt')); // extract 2 files only $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) { // handle errors } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::extractTo</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/isWritable.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/isWritable.xml +++ phpdoc/en/reference/phar/PharData/isWritable.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="phardata.iswritable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>PharData::isWritable</refname> <refpurpose>Returns true if the tar/zip archive can be modified</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>PharData::isWritable</methodname> <void/> </methodsynopsis> <para> This method returns &true; if the tar/zip archive on disk is not read-only. Unlike <function>Phar::isWritable</function>, data-only tar/zip archives can be modified even if <literal>phar.readonly</literal> is set to <literal>1</literal>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> No parameters. </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns &true; if the tar/zip archive can be modified </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::canWrite</function></member> <member><function>Phar::isWritable</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/phar/PharData/setDefaultStub.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/phar/PharData/setDefaultStub.xml +++ phpdoc/en/reference/phar/PharData/setDefaultStub.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="phardata.setdefaultstub"> <refnamediv> <refname>PharData::setDefaultStub</refname> <refpurpose>dummy function (Phar::setDefaultStub is not valid for PharData)</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>PharData::setDefaultStub</methodname> <methodparam choice="opt"><type>string</type><parameter>index</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>webindex</parameter></methodparam> </methodsynopsis> <para> Non-executable tar/zip archives cannot have a stub, so this method simply throws an exception. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>index</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed on the command-line </para> </listitem> </varlistentry> <varlistentry> <term><parameter>webindex</parameter></term> <listitem> <para> Relative path within the phar archive to run if accessed through a web browser </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="errors"> &reftitle.errors; <para> Throws <classname>PharException</classname> on all method calls </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>Phar::setDefaultStub</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 -->