php-doc-en/reference/rar/functions/rar-extract.xml
Torben Wilson af4410a7e1 Normalized the sgml-default-dtd-file local-variable line for those
still using this, after discussion on the phpdoc list.
From now on, manual.ced will need to be found at ~/.phpdoc/manual.ced.



git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@288721 c90b9560-bf6c-de11-be94-00142212c4b1
2009-09-25 07:04:39 +00:00

126 lines
3.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xml:id="function.rar-extract" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>Rar::extract</refname>
<refpurpose>Extract entry from the archive</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>Rar</classname></ooclass>
<methodsynopsis>
<type>bool</type><methodname>extract</methodname>
<methodparam><type>string</type><parameter>dir</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>filepath</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
<function>Rar::extract</function> extracts entry's data to the
<parameter>dir</parameter>. It will create new file in the specified
<parameter>dir</parameter> with the name identical to the entry's name.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>dir</parameter></term>
<listitem>
<para>
Path to the directory where files should be extracted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>filepath</parameter></term>
<listitem>
<para>
If parameter <parameter>filepath</parameter> is specified instead
<parameter>dir</parameter>, <function>Rar::extract</function> will extract
entry's data to the specified file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Rar::extract</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");
$entry->extract('/dir/to'); // create /dir/to/Dir/file.txt
$entry->extract(false, '/dir/to/new_name.txt'); // create /dir/to/new_name.txt
?>
]]>
</programlisting>
</example>
<example>
<title>How to extract all files in archive: </title>
<programlisting role="php">
<![CDATA[
<?php
/* example by Erik Jenssen aka erix */
$filename = "foobar.rar";
$filepath = "/home/foo/bar/";
$rar_file = rar_open($filepath.$filename);
$list = rar_list($rar_file);
foreach($list as $file) {
$entry = rar_entry_get($rar_file, $file);
$entry->extract("."); // extract to the current dir
}
rar_close($rar_file);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.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
-->