Query: xdiff_file_patch
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XDIFF_FILE_PATCH(3) 1 XDIFF_FILE_PATCH(3) xdiff_file_patch - Patch a file with an unified diffSYNOPSISmixed xdiff_file_patch (string $file, string $patch, string $dest, [int $flags = DIFF_PATCH_NORMAL])DESCRIPTIONPatches a $file with a $patch and stores the result in a file. $patch has to be an unified diff created by xdiff_file_diff(3)/xdiff_string_diff(3) function. An optional $flags parameter specifies mode of operation.PARAMETERSo $file - The original file. o $patch - The unified patch file. It has to be created using xdiff_string_diff(3), xdiff_file_diff(3) functions or compatible tools. o $dest - Path of the resulting file. o $flags - Can be either XDIFF_PATCH_NORMAL (default mode, normal patch) or XDIFF_PATCH_REVERSE (reversed patch). Starting from version 1.5.0, you can also use binary OR to enable XDIFF_PATCH_IGNORESPACE flag.RETURN VALUESReturns FALSE if an internal error happened, string with rejected chunks if patch couldn't be applied or TRUE if patch has been success- fully applied.EXAMPLESExample #1 xdiff_file_patch(3) example The following code applies unified diff to a file. <?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 "Rejects: "; echo $errors; } ?> Example #2 Patch reversing example The following code reverses a patch. <?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 "Rejects: "; echo $errors; } ?>SEE ALSOxdiff_file_diff(3). PHP Documentation Group XDIFF_FILE_PATCH(3)
Related Man Pages |
---|
patcher(1) - debian |
mrtg-contrib(1) - centos |
patcher(1) - hpux |
edit-patch(1) - linux |
git-patch-id(1) - osx |
Similar Topics in the Unix Linux Community |
---|
Patch help? |
Patch PHKL_20529 for HPUX 10.20 |
Patch for OS5.9 118558-10 |
change the output |
find -exec How to add additional parameter when calling a funtion |