downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.xdiff-file-bpatch.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-bpatch.php',
   
1 => 'xdiff_file_bpatch',
  ),
 
'up' =>
  array (
   
0 => 'ref.xdiff.php',
   
1 => 'xdiff Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.xdiff-file-bdiff.php',
   
1 => 'xdiff_file_bdiff',
  ),
 
'next' =>
  array (
   
0 => 'function.xdiff-file-diff-binary.php',
   
1 => 'xdiff_file_diff_binary',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.xdiff-file-bpatch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xdiff_file_bpatch</h1>
  <p class="verinfo">(PECL xdiff &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">xdiff_file_bpatch</span> &mdash; <span class="dc-title">Patch a file with a binary diff</span></p>

 </div>
 
 <a name="function.xdiff-file-bpatch.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_bpatch</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$file</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$patch</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$dest</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Patches a <i><tt class="parameter">file</tt></i>
 with a binary
   <i><tt class="parameter">patch</tt></i>
 and stores the result in a file <i><tt class="parameter">dest</tt></i>
.
   This function accepts patches created both via <a href="function.xdiff-file-bdiff.php" class="function">xdiff_file_bdiff()</a>
   and <a href="function.xdiff-file-rabdiff.php" class="function">xdiff_file_rabdiff()</a> functions or their string counterparts.
  </p>
 </div>


 <a name="function.xdiff-file-bpatch.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">file</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The original file.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">patch</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The binary patch 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 file.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.xdiff-file-bpatch.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-bpatch.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_bpatch()</b> example</b></p>
    <div class="example-contents para"><p>
     The following code applies binary diff to a file.
    </p></div>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$old_version&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'archive-1.0.tgz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$patch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'archive.bpatch'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xdiff_file_bpatch</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$patch</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'archive-1.1.tgz'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"File&nbsp;patched"</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"File&nbsp;couldn't&nbsp;be&nbsp;patched"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.xdiff-file-bpatch.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>:
  
    Both files (<i><tt class="parameter">file</tt></i>
 and <i><tt class="parameter">patch</tt></i>
)
    will be loaded into memory so ensure that your memory_limit is set high
    enough.
   <br />
  </p></blockquote>
 </div>


 <a name="function.xdiff-file-bpatch.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-bdiff.php" class="function" rel="rdfs-seeAlso">xdiff_file_bdiff()</a> - Make binary diff of two files</li>
    <li class="member"><a href="function.xdiff-file-rabdiff.php" class="function" rel="rdfs-seeAlso">xdiff_file_rabdiff()</a> - Make binary diff of two files using the Rabin's polynomial fingerprinting algorithm</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites