mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
add ZipArchive::replaceFile() method
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@349293 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9ac8f763f2
commit
4cb0a309c9
3 changed files with 150 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
<function name="ZipArchive::rename" from="PHP 5 >= 5.2.0, PHP 7, PECL zip < 1.5.0"/>
|
||||
<function name="ZipArchive::renameIndex" from="PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.5.0"/>
|
||||
<function name="ZipArchive::renameName" from="PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.5.0"/>
|
||||
<function name="ZipArchive::replaceFile" from="PHP >= 8.0.0, PECL zip >= 1.18.0"/>
|
||||
<function name="ZipArchive::registerProgressCallback" from="PHP >= 8.0.0, PECL zip >= 1.17.0"/>
|
||||
<function name="ZipArchive::registerCancelCallback" from="PHP >= 8.0.0, PECL zip >= 1.17.0"/>
|
||||
<function name="ZipArchive::setArchiveComment" from="PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.4.0"/>
|
||||
|
|
|
@ -131,6 +131,16 @@ if ($zip->open('test.zip') === TRUE) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ZipArchive::replaceFile</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
|
|
139
reference/zip/ziparchive/replacefile.xml
Normal file
139
reference/zip/ziparchive/replacefile.xml
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 349282 $ -->
|
||||
<refentry xml:id="ziparchive.replacefile" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>ZipArchive::replaceFile</refname>
|
||||
<refpurpose>Replaces a file to a ZIP archive from the given path</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>ZipArchive::replaceFile</methodname>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>index</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>start</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>length</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>ZipArchive::FL_OVERWRITE</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Replace a file to a ZIP archive from a given path.
|
||||
</para>
|
||||
&zip.filename.separator;
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The path to the file to add.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>index</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The index of the file to be replaced, its name is unchanged.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>start</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This parameter is not used but is required to extend <classname>ZipArchive</classname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>length</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This parameter is not used but is required to extend <classname>ZipArchive</classname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Bitmask consisting of
|
||||
<constant>ZipArchive::FL_ENC_GUESS</constant>,
|
||||
<constant>ZipArchive::FL_ENC_UTF_8</constant>,
|
||||
<constant>ZipArchive::FL_ENC_CP437</constant>.
|
||||
The behaviour of these constants is described on the
|
||||
<link linkend="zip.constants">ZIP constants</link> page.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
This example opens a ZIP file archive
|
||||
<filename>test.zip</filename> and add
|
||||
the file <filename>/path/to/index.txt</filename>.
|
||||
as <filename>newname.txt</filename>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Open and add</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open('test.zip') === TRUE) {
|
||||
$zip->replaceFile('/path/to/index.txt', 1);
|
||||
$zip->close();
|
||||
echo 'ok';
|
||||
} else {
|
||||
echo 'failed';
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ZipArchive::addFile</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
|
||||
-->
|
Loading…
Reference in a new issue