mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 09:52:17 +01:00
168 lines
4.6 KiB
XML
168 lines
4.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 14af302c9c0e561fa6f9cdd956268758ba9a89c5 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.xdiff-file-patch" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>xdiff_file_patch</refname>
|
|
<refpurpose>Patche un fichier avec un diff unifié</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>xdiff_file_patch</methodname>
|
|
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>patch</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>dest</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>DIFF_PATCH_NORMAL</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Patche le fichier <parameter>file</parameter> avec le patch fourni par
|
|
le paramètre <parameter>patch</parameter> et enregistre le résultat dans un
|
|
fichier. <parameter>patch</parameter> doit être un diff unifié créé par la
|
|
fonction <function>xdiff_file_diff</function>/<function>xdiff_string_diff</function>.
|
|
Un paramètre optionnel <parameter>flags</parameter> spécifie le mode de
|
|
l'opération.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>file</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le fichier original.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>patch</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le fichier contenant le patch unifié. Il doit avoir été créé en utilisant
|
|
les fonctions <function>xdiff_string_diff</function>,
|
|
<function>xdiff_file_diff</function> ou par des outils compatibles.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>dest</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le chemin vers le fichier résultat.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Peut être soit <constant>XDIFF_PATCH_NORMAL</constant> (mode par
|
|
défaut, patch normal) ou <constant>XDIFF_PATCH_REVERSE</constant>
|
|
(patch inversé).
|
|
</para>
|
|
<para>
|
|
Depuis la version 1.5.0, vous pouvez également utiliser l'opérateur
|
|
binaire OR pour activer le drapeau
|
|
<constant>XDIFF_PATCH_IGNORESPACE</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne &false; si une erreur interne s'est produite, une
|
|
chaîne avec les parties rejetées du <parameter>patch</parameter> si c'est le
|
|
cas ou &true; si le <parameter>patch</parameter> a été appliqué avec succès.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>xdiff_file_patch</function></title>
|
|
<para>
|
|
Le code suivant applique un diff à un fichier.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$old_version = 'my_script-1.0.php';
|
|
$patch = 'my_script.patch';
|
|
|
|
$errors = xdiff_file_patch($old_version, $patch, 'my_script-1.1.php');
|
|
if (is_string($errors)) {
|
|
echo "Rejets :\n";
|
|
echo $errors;
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Exemple de retour à l'état initial après l'application d'un patch</title>
|
|
<para>
|
|
Le code suivant annule un patch.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$new_version = 'my_script-1.1.php';
|
|
$patch = 'my_script.patch';
|
|
|
|
$errors = xdiff_file_patch($new_version, $patch, 'my_script-1.0.php', XDIFF_PATCH_REVERSE);
|
|
if (is_string($errors)) {
|
|
echo "Rejets :\n";
|
|
echo $errors;
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>xdiff_file_diff</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:"~/.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
|
|
-->
|