Source of: /manual/en/function.xdiff-file-rabdiff.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xdiff.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.xdiff-file-rabdiff.php',
1 => 'xdiff_file_rabdiff',
),
'up' =>
array (
0 => 'ref.xdiff.php',
1 => 'xdiff Functions',
),
'prev' =>
array (
0 => 'function.xdiff-file-patch.php',
1 => 'xdiff_file_patch',
),
'next' =>
array (
0 => 'function.xdiff-string-bdiff-size.php',
1 => 'xdiff_string_bdiff_size',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.xdiff-file-rabdiff" class="refentry">
<div class="refnamediv">
<h1 class="refname">xdiff_file_rabdiff</h1>
<p class="verinfo">(PECL xdiff >= 0.2.0)</p><p class="refpurpose"><span class="refname">xdiff_file_rabdiff</span> — <span class="dc-title">Make binary diff of two files using the Rabin's polynomial fingerprinting algorithm</span></p>
</div>
<a name="function.xdiff-file-rabdiff.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><b>xdiff_file_rabdiff</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$old_file</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$new_file</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$dest</tt></span>
)</div>
<p class="para rdfs-comment">
Makes a binary diff of two files and stores the result in a patch file.
The difference between this function and <a href="function.xdiff-file-bdiff.php" class="function">xdiff_file_bdiff()</a> is different
algorithm used which should result in faster execution and smaller diff produced.
This function works with both text and binary files. Resulting patch
file can be later applied using <a href="function.xdiff-file-bpatch.php" class="function">xdiff_file_bpatch()</a>/<a href="function.xdiff-string-bpatch.php" class="function">xdiff_string_bpatch()</a>.
</p>
<p class="para">
For more details about differences between algorithm used please check <a href="http://www.xmailserver.org/xdiff-lib.html" class="link external">» libxdiff</a>
website.
</p>
</div>
<a name="function.xdiff-file-rabdiff.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">old_file</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path to the first file. This file acts as "old" file.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">new_file</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path to the second file. This file acts as "new" file.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">dest</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path of the resulting patch file. Resulting file contains differences
between "old" and "new" files. It is in binary format and is human-unreadable.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.xdiff-file-rabdiff.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
</div>
<a name="function.xdiff-file-rabdiff.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>xdiff_file_rabdiff()</b> example</b></p>
<div class="example-contents para"><p>
The following code makes binary diff of two archives.
</p></div>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />$old_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'my_script_1.0.tgz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$new_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'my_script_1.1.tgz'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">xdiff_file_rabdiff</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">, </span><span style="color: #0000BB">$new_version</span><span style="color: #007700">, </span><span style="color: #DD0000">'my_script.bdiff'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.xdiff-file-rabdiff.notes"></a><div class="refsect1 notes">
<h3 class="title">Notes</h3>
<blockquote><p><b class="note">Note</b>:
Both files will be loaded into memory so ensure that your memory_limit is
set high enough.
<br />
</p></blockquote>
</div>
<a name="function.xdiff-file-rabdiff.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.xdiff-file-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_file_bpatch()</a> - Patch a file with a binary diff</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>