Updated with new functions; a few fixes.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@300960 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Gustavo André dos Santos Lopes 2010-07-03 02:03:51 +00:00
parent 20ccf7dc53
commit 5699ed7b61
11 changed files with 454 additions and 11 deletions

View file

@ -26,6 +26,7 @@
&reference.rar.setup;
&reference.rar.constants;
&reference.rar.examples;
&reference.rar.reference;
&reference.rar.rararchive;
&reference.rar.rarentry;
&reference.rar.rarexception;

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.rar-wrapper-cache-stats" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>rar_wrapper_cache_stats</refname>
<refpurpose>Cache hits and misses for the URL wrapper.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>rar_wrapper_cache_stats</methodname>
<void />
</methodsynopsis>
<para>
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="rararchive.isbroken" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>RarArchive::isBroken</refname>
<refname>rar_broken_is</refname>
<refpurpose>Test whether an archive is broken (incomplete)</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>Object oriented style (method):</para>
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>RarArchive::isBroken</methodname>
<void />
</methodsynopsis>
<para>Procedural style:</para>
<methodsynopsis>
<type>bool</type><methodname>rar_broken_is</methodname>
<methodparam><type>RarArchive</type><parameter>rarfile</parameter></methodparam>
</methodsynopsis>
<para>
This function determines whether an archive is incomplete, i.e., if a volume is missing or a volume is truncated.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>rarfile</parameter></term>
<listitem>
<para>
A <type>RarArchive</type> object, opened with <function>rar_open</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the archive is broken, &false; otherwise. This function may also
also return &false; if the passed file has already been closed. The only way
to tell the two cases apart is to enable
exceptions with <methodname>RarException::setUsingExceptions</methodname>; however,
this should be unnecessary as a program should not operate on closed files.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Object oriented style</title>
<programlisting role="php">
<![CDATA[
<?php
function retnull() { return null; }
$file = dirname(__FILE__) . "/multi_broken.part1.rar";
/* Third argument is used to omit notice */
$arch = RarArchive::open($file, null, 'retnull');
var_dump($arch->isBroken());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Procedural style</title>
<programlisting role="php">
<![CDATA[
<?php
function retnull() { return null; }
$file = dirname(__FILE__) . "/multi_broken.part1.rar";
/* Third argument is used to omit notice */
$arch = rar_open($file, null, 'retnull');
var_dump(rar_broken_is($arch));
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>RarArchive::setAllowBroken</methodname></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:"~/.phpdoc/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,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="rararchive.open" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
@ -14,13 +14,15 @@
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>RarArchive</type><methodname>RarArchive::open</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>NULL</initializer></methodparam>
<methodparam choice="opt"><type>callback</type><parameter>volume_callback</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>Procedural style:</para>
<methodsynopsis>
<type>RarArchive</type><methodname>rar_open</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>NULL</initializer></methodparam>
<methodparam choice="opt"><type>callback</type><parameter>volume_callback</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>
Open specified RAR archive and return <type>RarArchive</type> instance representing it.
@ -55,6 +57,23 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>volume_callback</parameter></term>
<listitem>
<para>
A function that receives one parameter the path of the volume
that was not found and returns a string with the correct path
for such volume or <literal>NULL</literal> if such volume does
not exist or is not known. The programmer should ensure the
passed function doesn't cause loops as this function is called
repetedly if the path returned in a previous call did not
correspond to the needed volume. Specifying this parameter omits
the notice that would otherwise be emitted whenever a volume is
not found; an implementation that only returns &false; can
therefore be used to merely omit such notices.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<warning>
@ -70,6 +89,30 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>3.0.0</entry>
<entry>
<parameter>volume_callback</parameter> was added.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
@ -144,6 +187,27 @@ echo stream_get_contents($stream);
fclose($stream);
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Volume Callback</title>
<programlisting role="php">
<![CDATA[
<?php
/* In this example, there's a volume named multi_broken.part1.rar
* whose next volume is named multi.part2.rar */
function resolve($vol) {
if (preg_match('/_broken/', $vol))
return str_replace('_broken', '', $vol);
else
return null;
}
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
$entry = $rar_file1->getEntry('file2.txt');
$entry->extract(null, dirname(__FILE__) . "/temp_file2.txt");
]]>
</programlisting>
</example>

View file

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="rararchive.setallowbroken" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>RarArchive::setAllowBroken</refname>
<refpurpose>Whether opening broken archives is allowed</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>Object oriented style (method):</para>
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>RarArchive::setAllowBroken</methodname>
<methodparam><type>bool</type><parameter>allow_broken</parameter></methodparam>
</methodsynopsis>
<para>Procedural style:</para>
<methodsynopsis>
<type>bool</type><methodname>rar_allow_broken_set</methodname>
<methodparam><type>RarArchive</type><parameter>rarfile</parameter></methodparam>
<methodparam><type>bool</type><parameter>allow_broken</parameter></methodparam>
</methodsynopsis>
<para>
This method defines whether broken archives can be read or all the operations that
attempt to extract the archive entries will fail. Broken archives are archives for
which no error is detected when the file is opened but an error occurs when reading
the entries.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>rarfile</parameter></term>
<listitem>
<para>
A <type>RarArchive</type> object, opened with <function>rar_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>allow_broken</parameter></term>
<listitem>
<para>
Whether to allow reading broken files (&true;) or not (&false;).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; &return.falseforfailure;. It will only fail if the file has
already been closed.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Object oriented style</title>
<programlisting role="php">
<![CDATA[
<?php
function retnull() { return null; }
$file = dirname(__FILE__) . "/multi_broken.part1.rar";
/* Third argument omits "volume not found" message */
$a = RarArchive::open($file, null, 'retnull');
$a->setAllowBroken(true);
foreach ($a->getEntries() as $e) {
echo "$e\n";
}
var_dump(count($a));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
RarEntry for file "file1.txt" (52b28202)
int(1)
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Procedural style</title>
<programlisting role="php">
<![CDATA[
<?php
function retnull() { return null; }
$file = dirname(__FILE__) . "/multi_broken.part1.rar";
/* Third argument omits "volume not found" message */
$a = rar_open($file, null, 'retnull');
rar_allow_broken_set($a, true);
foreach (rar_list($a) as $e) {
echo "$e\n";
}
var_dump(count($a));
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>RarArchive::isBroken</methodname></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:"~/.phpdoc/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

@ -564,7 +564,8 @@
<varlistentry xml:id="rarentry.constants.attribute-unix-final-quartet">
<term><constant>RarEntry::ATTRIBUTE_UNIX_FINAL_QUARTET</constant></term>
<listitem>
<para>Mask to isolate the last four bits of UNIX attributes. To be used with
<para>Mask to isolate the last four bits (nibble) of UNIX attributes
(_S_IFMT, the type of file mask). To be used with
<methodname>RarEntry::getAttr</methodname> on entries whose host OS is UNIX and with the
constants <link linkend="rarentry.constants.attribute-unix-fifo"><constant>RarEntry::ATTRIBUTE_UNIX_FIFO</constant></link>,
<link linkend="rarentry.constants.attribute-unix-char-dev"><constant>RarEntry::ATTRIBUTE_UNIX_CHAR_DEV</constant></link>,

View file

@ -11,8 +11,9 @@
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>RarEntry::extract</methodname>
<methodparam><type>string</type><parameter>dir</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>filepath</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>filepath</parameter><initializer>''</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>NULL</initializer></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>extended_data</parameter><initializer>false</initializer></methodparam>
</methodsynopsis>
<para>
<methodname>RarEntry::extract</methodname> extracts the entry's data.
@ -62,6 +63,16 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>extended_data</parameter></term>
<listitem>
<para>
If &true;, extended information such as NTFS ACLs and Unix owner information will be set in the extract
files, as long as it's present in the archive.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<warning>
@ -77,6 +88,30 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>3.0.0</entry>
<entry>
<parameter>extended_data</parameter> was added.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -10,7 +10,7 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>resource</type><methodname>RarEntry::RarEntry::getStream</methodname>
<modifier>public</modifier> <type>resource</type><methodname>RarEntry::getStream</methodname>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>

View file

@ -10,7 +10,7 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>RarEntry::RarEntry::isDirectory</methodname>
<modifier>public</modifier> <type>bool</type><methodname>RarEntry::isDirectory</methodname>
<void/>
</methodsynopsis>
<para>

View file

@ -53,9 +53,15 @@ phpize
<section xml:id="rar.resources">
&reftitle.resources;
<para>
This extension registers two internal classes:
The archive representations returned by <function>rar_open</function> and the
entry representations returned by <function>rar_list</function> and <function>rar_entry_get</function>.
This extension registers three internal classes:
The archive representations returned by <function>rar_open</function>
<type>RarArchive</type> , the entry representations returned by
<function>rar_list</function> and <function>rar_entry_get</function>
<type>RarEntry</type> and the exception type <type>RarException</type>.
</para>
<para>
This extension also register a stream resource, called "rar" and a URL
wrapper called "rar wrapper" and registered under the prefix "rar".
</para>
</section>
<!-- }}} -->

View file

@ -11,17 +11,24 @@
<function name='rar_entry_get' from='PECL rar &gt;= 0.1'/>
<function name='rar_solid_is' from='PECL rar &gt;= 2.0.0'/>
<function name='rar_comment_get' from='PECL rar &gt;= 2.0.0'/>
<function name='rar_broken_is' from='PECL rar &gt;= 3.0.0'/>
<function name='rar_allow_broken_set' from='PECL rar &gt;= 3.0.0'/>
<function name='rar_close' from='PECL rar &gt;= 0.1'/>
<function name='rar_wrapper_cache_stats' from='PECL rar &gt;= 3.0.0'/>
<!-- Methods -->
<function name='rararchive::open' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::getentries' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::getentry' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::issolid' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::getcomment' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::isbroken' from='PECL rar &gt;= 3.0.0'/>
<function name='rararchive::setallowbroken' from='PECL rar &gt;= 3.0.0'/>
<function name='rararchive::close' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::__tostring' from='PECL rar &gt;= 2.0.0'/>
<function name='rararchive::__construct' from='PECL rar &gt;= 2.0.0'/>
<function name='rarentry::extract' from='PECL rar &gt;= 0.1'/>
<function name='rarentry::getposition' from='PECL rar &gt;= 3.0.0'/>
<function name='rarentry::getname' from='PECL rar &gt;= 0.1'/>
<function name='rarentry::getunpackedsize' from='PECL rar &gt;= 0.1'/>
<function name='rarentry::getpackedsize' from='PECL rar &gt;= 0.1'/>