add docs for new functionality, update docs for old, fix a small typo

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@228280 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Greg Beaver 2007-01-28 05:31:52 +00:00
parent 0dbc7d65b8
commit 7dc7b75cb8
11 changed files with 916 additions and 4 deletions

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.Phar-beginWrite">
<refnamediv>
<refname>Phar-&gt;beginWrite</refname>
<refpurpose>Begin a Phar modification transaction</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>Phar-&gt;beginWrite</methodname>
<void/>
</methodsynopsis>
<para>
Although technically unnecessary, the <function>beginWrite</function> method
can provide a significant performance boost when creating or modifying a
Phar archive with a large number of files. Ordinarily, every time a file
within a Phar archive is created or modified in any way, the entire Phar
archive will be recreated with the changes. In this way, the archive will
be up-to-date with the activity performed on it.
</para>
<para>
However, this can be unnecessary when simply creating a new Phar archive,
when it would make more sense to write the entire archive out at once.
Similarly, it is often necessary to make a series of changes and to ensure
that they all are possible before making any changes on disk, similar to the
relational database concept of transactions. the
<function>beginWrite</function>/<function>commitWrite</function> pair
of methods is provided for this purpose.
</para>
<para>
Phar transactions are per-archive, a transaction active on the
<literal>foo.phar</literal> Phar archive does not affect changes
to the <literal>bar.phar</literal> Phar archive.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>Phar-&gt;beginWrite</function> example</title>
<para>
</para>
<programlisting role="php">
<![CDATA[
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar('brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
echo 'The new phar has ' . $p->count() . " entries\n";
$p->beginWrite();
$p['file.txt'] = 'hi';
$p['file2.txt'] = 'there';
$p['file2.txt']->setCompressedGZ();
$p['file3.txt'] = 'babyface';
$p['file3.txt']->setMetaData(42);
$p->commitWrite("<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER();
?>");
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.Phar-commitWrite"><function>Phar-&gt;commitWrite</function></link></member>
<member><link linkend="function.Phar-getStub"><function>Phar-&gt;getStub</function></link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.Phar-commitWrite">
<refnamediv>
<refname>Phar-&gt;commitWrite</refname>
<refpurpose>End a Phar modification transaction by writing the Phar archive to disk</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>Phar-&gt;commitWrite</methodname>
<void/>
</methodsynopsis>
<para>
Although technically unnecessary, the <function>beginWrite</function> method
can provide a significant performance boost when creating or modifying a
Phar archive with a large number of files. Ordinarily, every time a file
within a Phar archive is created or modified in any way, the entire Phar
archive will be recreated with the changes. In this way, the archive will
be up-to-date with the activity performed on it.
</para>
<para>
However, this can be unnecessary when simply creating a new Phar archive,
when it would make more sense to write the entire archive out at once.
Similarly, it is often necessary to make a series of changes and to ensure
that they all are possible before making any changes on disk, similar to the
relational database concept of transactions. the
<function>beginWrite</function>/<function>commitWrite</function> pair
of methods is provided for this purpose.
</para>
<para>
Phar transactions are per-archive, a transaction active on the
<literal>foo.phar</literal> Phar archive does not affect changes
to the <literal>bar.phar</literal> Phar archive.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>Phar-&gt;commitWrite</function> example</title>
<para>
</para>
<programlisting role="php">
<![CDATA[
<?php
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file1.txt'] = 'hi';
$p->commitWrite();
var_dump($p->getStub());
$p->commitWrite("<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(24) "<?php __HALT_COMPILER();"
string(186) "<?php
function __autoload()
{
include 'phar://' . str_replace('_', '/', );
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
?>"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.Phar-beginWrite"><function>Phar-&gt;beginWrite</function></link></member>
<member><link linkend="function.Phar-getStub"><function>Phar-&gt;getStub</function></link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.Phar-count">
<refnamediv>
<refname>Phar-&gt;count</refname>
@ -24,7 +24,8 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of files containd within this phar, or 0 (the number zero) if none.
The number of files contained within this phar, or <literal>0</literal> (the number zero)
if none.
</para>
</refsect1>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.Phar-getSignature">
<refnamediv>
<refname>Phar-&gt;getSignature</refname>
<refpurpose>Return MD5/SHA1 signature of a Phar archive</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>Phar-&gt;getSignature</methodname>
<void/>
</methodsynopsis>
<para>
Returns the verification signature of a phar archive in a hexadecimal string.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The opened archive's signature. This signature is a hash calculated on the
entire phar's contents, and may be used to verify the integrity of the archive.
A valid signature is absolutely required of all phars if the
<link linkend="ini.phar.require-hash">phar.require_hash</link> INI variable
is set to true.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.Phar-getStub">
<refnamediv>
<refname>Phar-&gt;getStub</refname>
<refpurpose>Return the PHP loader or bootstrap stub of a Phar archive</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>Phar-&gt;getStub</methodname>
<void/>
</methodsynopsis>
<para>
One of the features that differentiates a Phar archive from other familiar archive
formats like tar or zip is that a Phar archive is explicitly designed to be
included to allow distributing an application or library that can be
run without extraction directly from the archive. In order to accomplish
this, Phar archives contain a bootstrap loader, or <literal>stub</literal>
written in PHP that can perform any action.
</para>
<warning>
<simpara>All stubs must end with
<literal>__HALT_COMPILER();</literal> or the file is not a valid Phar archive.</simpara>
</warning>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a string containing the contents of the bootstrap loader (stub) of
the current Phar archive.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>Phar-&gt;getStub</function> example</title>
<programlisting role="php">
<![CDATA[
$p = new Phar('myphar.phar');
echo $p->getStub();
echo "==NEXT==\n";
$p->commitWrite("<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER();
?>");
echo $p->getStub();
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<?php __HALT_COMPILER();
==NEXT==
<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER();
?>
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.Phar-commitWrite"><function>Phar-&gt;commitWrite</function></link></member>
<member><link linkend="function.Phar-beginWrite"><function>Phar-&gt;beginWrite</function></link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.PharFileInfo-getMetaData">
<refnamediv>
<refname>PharFileInfo-&gt;getMetaData</refname>
<refpurpose>Returns file-specific meta-data saved with a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PharFileInfo-&gt;getMetaData</methodname>
<void/>
</methodsynopsis>
<para>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
any PHP variable that can be serialized and is stored as meta-data for the file,
or &null; if no meta-data is stored.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo-&gt;getMetaData</function> example</title>
<para>
</para>
<programlisting role="php">
<![CDATA[
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar('brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
$p['file.txt'] = 'hello';
$p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetaData());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
["user"]=>
string(4) "bill"
["mime-type"]=>
string(10) "text/plain"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.PharFileInfo-setMetaData"><function>PharFileInfo-&gt;setMetaData</function></link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.PharFileInfo-setCompressedBZIP2">
<refnamediv>
<refname>PharFileInfo-&gt;setCompressedBZIP2</refname>
<refpurpose>Compresses the current Phar entry within the phar using Bzip2 compression</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PharFileInfo-&gt;setCompressedBZIP2</methodname>
<void/>
</methodsynopsis>
<para>
This method causes the file referenced to be compressed using bzip2 compression.
The <link linkend="ref.bzip2">bzip2</link> extension must be enabled to take
advantage of this feature. In addition, if the file is already compressed using
gzip compression, the <link linkend="ref.zlib">zlib</link> extension must be enabled in order
to decompress the file As with all functionality that modifies the contents of
a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable
must be off in order to succeed.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>BadMethodCallException</classname> if
the <link linkend="ini.phar.readonly">phar.readonly</link>
INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>
extension is not available.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo-&gt;setCompressedBZIP2</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new Phar('my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
var_dump($file->isCompressedBZIP2());
$p['myfile.txt']->setCompressedBZIP2();
var_dump($file->isCompressedBZIP2());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member>
<member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member>
<member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member>
</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
-->

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.PharFileInfo-setCompressedGZ">
<refnamediv>
<refname>PharFileInfo-&gt;setCompressedGZ</refname>
<refpurpose>Compresses the current Phar entry within the phar using gz compression</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PharFileInfo-&gt;setCompressedGZ</methodname>
<void/>
</methodsynopsis>
<para>
This method causes the file referenced to be compressed using gzip compression.
The <link linkend="ref.zlib">zlib</link> extension must be enabled to take
advantage of this feature. In addition, if the file is already compressed using
bzip2 compression, the <link linkend="ref.bzip2">bzip2</link> extension must be enabled in order
to decompress the file. As with all functionality that modifies the contents of
a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable
must be off in order to succeed.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>BadMethodCallException</classname> if
the <link linkend="ini.phar.readonly">phar.readonly</link>
INI variable is on, or if the <link linkend="ref.zlib">zlib</link>
extension is not available.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo-&gt;setCompressedGZ</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new Phar('my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
var_dump($file->isCompressedGZ());
$p['myfile.txt']->setCompressedGZ();
var_dump($file->isCompressedGZ());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member>
<member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member>
<member><link linkend="function.PharFileInfo-setUncompressed"><function>PharFileInfo-&gt;isCompressed</function></link></member>
</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
-->

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.PharFileInfo-setMetaData">
<refnamediv>
<refname>PharFileInfo-&gt;getMetaData</refname>
<refpurpose>Sets file-specific meta-data saved with a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PharFileInfo-&gt;setMetaData</methodname>
<void/>
</methodsynopsis>
<para>
<function>setMetaData</function> should only be used to store customized data in a file
that cannot be represented with existing information stored with a file.
Meta-data can significantly slow down the performance of loading a phar
archive if the data is large, or if there are many files containing meta-data.
It is important to note that file permissions are natively supported inside a
phar, and you can use <function>chmod</function> to change the permissions of
files inside a phar. As with all functionality that modifies the contents of
a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable must be
off in order to succeed.
</para>
<para>
Some possible uses for meta-data include passing a user/group that should be set
when a file is extracted from the phar to disk. Other uses could include
explicitly specifying a MIME type to return. However, any useful data that
describes a file, but should not be contained inside of it may be stored.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>metadata</parameter></term>
<listitem>
<para>
Any PHP variable containing information to store alongside a file
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo-&gt;setMetaData</function> example</title>
<para>
</para>
<programlisting role="php">
<![CDATA[
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar('brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
$p['file.txt'] = 'hello';
$p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetaData());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
["user"]=>
string(4) "bill"
["mime-type"]=>
string(10) "text/plain"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.PharFileInfo-getMetaData"><function>PharFileInfo-&gt;getMetaData</function></link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.PharFileInfo-setUncompressed">
<refnamediv>
<refname>PharFileInfo-&gt;setUncompressed</refname>
<refpurpose>Uncompresses the current Phar entry within the phar, if it is compressed</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PharFileInfo-&gt;setUncompressed</methodname>
<void/>
</methodsynopsis>
<para>
This method causes the file referenced to be uncompressed and re-saved.
Depending on how the file is compressed, the <link linkend="ref.bzip2">bzip2</link>
or <link linkend="ref.zlib">zlib</link> extensions must be enabled to take
advantage of this feature. As with all functionality that modifies the contents of
a phar, the <link linkend="ini.phar.readonly">phar.readonly</link> INI variable
must be off in order to succeed.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>BadMethodCallException</classname> if
the <link linkend="ini.phar.readonly">phar.readonly</link>
INI variable is on, or if the <link linkend="ref.bzip2">bzip2</link>/<link linkend="ref.zlib">zlib</link>
extension is not available.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo-&gt;setUncompressed</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$p = new Phar('my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
$file->setCompressedGZ();
var_dump($file->isCompressed());
$p['myfile.txt']->setUncompressed();
var_dump($file->isCompressed());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(false)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo-&gt;getCompressedSize</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member>
<member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo-&gt;isCompressedBZIP2</function></link></member>
<member><link linkend="function.PharFileInfo-setCompressedGZ"><function>PharFileInfo-&gt;isCompressedGZ</function></link></member>
<member><link linkend="function.PharFileInfo-setCompressedBZIP2"><function>PharFileInfo-&gt;isCompressed</function></link></member>
</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
-->

View file

@ -1,5 +1,5 @@
<?xml version = '1.0' encoding = 'iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- Purpose: -->
<!-- Membership: pecl -->
<reference id="ref.phar" >
@ -37,7 +37,7 @@
<section id="phar.requirements" >
&reftitle.required;
<para>
Phar requires PHP 5.2.0 or newer. Additional features require the
Phar requires PHP 5.2.1 or newer. Additional features require the
<link linkend="ref.spl">SPL</link> extension in order to take advantage
of iteration and array access to a Phar's file contents. The <literal>phar</literal>
stream does not require any additional extensions to function.