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