Rapide Advanced Adulte
 
 Web|Image|Shop|Video|News|Wmx|Mobile|Wiki|Ajouter ce moteur

     Manuel PHP     
Partager
 
 
Partager
Partager

 

Table :

.xdiff file diff binary
.xdiff file diff
.xdiff file merge3
.xdiff file patch binary
.xdiff file patch
.xdiff string diff binary
.xdiff string diff
.xdiff string merge3
.xdiff string patch binary
.xdiff string patch
 
   

  xdiff_file_patch  


xdiff_file_patch

(PECL)

xdiff_file_patch -- Patche un fichier avec un diff unifié

Description

mixed xdiff_file_patch ( string file, string patch, string dest [, int flags] )

xdiff_file_patch() patche le fichier file avec le patch unifié dans le fichier patch et stocke le résultat dans le fichier dest.

flags peut être soit XDIFF_PATCH_NORMAL (mode par défaut, patch normal) ou XDIFF_PATCH_REVERSE (patch inversé).

Cette fonction retourne FALSE si une erreur interne s'est produite, une chaîne avec les parties rejetées du patch ou TRUE si le patch a été appliqué avec succès.

Exemple 1. Exemple avec xdiff_file_patch()

Le code suivant applique un diff à un fichier.

<?php
$ancienne_version
= 'mon_script-1.0.php';
$patch = 'mon_script.patch';

$errors = xdiff_file_patch($ancienne_version, $patch, 'my_script-1.1.php');
if (
is_string($errors)) {
   echo
"Rejets :\n";
   echo
$errors;
}

?>

Exemple 2. Exemple de retour à l'état initial après l'application d'un patch

Le code suivant annule un patch.

<?php
$nouvelle_version
= 'mon_script-1.1.php';
$patch = 'mon_script.patch';

$errors = xdiff_file_patch($nouvelle_version, $patch, 'mon_script-1.0.php', XDIFF_PATCH_REVERSE);
if (
is_string($errors)) {
   echo
"Rejets :\n";
   echo
$errors;
}

?>

Voir aussi xdiff_string_patch().


    Annonces       
 

 Retour au chapitre Php

 

Top
 

Ajouter JungleKey.fr à votre Explorateur

 
 

About Us | © 2007 JungleKey




iBlack | Mobile | Wiki | Ajouter ce moteur
.