<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="ziparchive.registercancelcallback" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>ZipArchive::registerCancelCallback</refname>
  <refpurpose>Register a callback to allow cancellation during archive close.</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="ZipArchive">
   <modifier>public</modifier> <type>bool</type><methodname>ZipArchive::registerCancelCallback</methodname>
   <methodparam><type>callable</type><parameter>callback</parameter></methodparam>
  </methodsynopsis>
  <para>
   Register a <parameter>callback</parameter> function to allow cancellation during archive close. 
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>callback</parameter></term>
     <listitem>
      <para>
       If this function return 0 operation will continue, other value it will be cancelled.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
    <para>
     This example creates a ZIP file archive
     <filename>php.zip</filename> and cancel
     operation on some run condition.
    </para>
    <example>
     <title>Archive a file</title>
     <programlisting role="php">
<![CDATA[
<?php
$zip = new ZipArchive();
if ($zip->open('php.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
	$zip->addFile(PHP_BINARY, 'php');
	$zip->registerCancelCallback(function () {
		return ($someruncondition ? -1 : 0);
	});
	$zip->close();
}
]]>
     </programlisting>
    </example>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    This function is only available if built against libzip ≥ 1.6.0.
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>ZipArchive::registerProgressCallback</methodname></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
-->
