mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-25 17:32:07 +01:00
127 lines
3.8 KiB
XML
127 lines
3.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: f5a5f5ae75cf140bd3dd65da52b70f6236b0e131 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.startbuffering">
|
|
<refnamediv>
|
|
<refname>Phar::startBuffering</refname>
|
|
<refpurpose>Démarre la mise en tampon de écritures Phar, ne modifie pas l'objet Phar sur le disque</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>void</type><methodname>Phar::startBuffering</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
Bien que techniquement inutile, la méthode <function>Phar::startBuffering</function>
|
|
peut fournir un gain de performance lors de la création ou la modification d'une archive
|
|
Phar avec un grand nombre de fichiers. D'ordinaire, chaque fois qu'un fichier au sein de
|
|
l'archive Phar est créé ou modifié, l'archive Phar entière et recréée en incluant les
|
|
changements. De cette manière, l'archive sera toujours à jour vis à vis des opération qui
|
|
y sont appliquées.
|
|
</para>
|
|
<para>
|
|
Alors que ceci peut paraître inutile lors de la création d'un archive Phar simple,
|
|
ça prend tout son sens lors de l'écriture en une fois de l'archive Phar entière.
|
|
De même, il est souvent nécessaire de faire une série de changements et de s'assurer
|
|
qu'ils sont tous possibles avant d'écrire sur le disque, un peu comme les transactions
|
|
des base de données relationnelles. Les fonctions
|
|
<function>Phar::startBuffering</function>/<function>Phar::stopBuffering</function> sont disponibles
|
|
dans ce but.
|
|
</para>
|
|
<para>
|
|
La mise en tampon Phar s'effectue par archive, le tampon actif pour l'archive Phar
|
|
<literal>foo.phar</literal> n'affecte pas les changements faits à l'archive Phar
|
|
<literal>bar.phar</literal>.
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
&no.function.parameters;
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Un exemple avec <function>Phar::startBuffering</function></title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// on s'assure que le phar n'existe pas déjà
|
|
@unlink('nouveau.phar');
|
|
try {
|
|
$p = new Phar(dirname(__FILE__) . '/nouveau.phar', 0, 'nouveau.phar');
|
|
} catch (Exception $e) {
|
|
echo 'Ne peut pas créer le phar:', $e;
|
|
}
|
|
echo 'Le nouveau phar a ' . $p->count() . " entrées\n";
|
|
$p->startBuffering();
|
|
$p['fichier.txt'] = 'salut';
|
|
$p['fichier2.txt'] = 'jolie';
|
|
$p['fichier2.txt']->setCompressedGZ();
|
|
$p['fichier3.txt'] = 'môme';
|
|
$p['fichier3.txt']->setMetadata(42);
|
|
$p->setStub("<?php
|
|
function __autoload($class)
|
|
{
|
|
include 'phar://monphar.phar/' . str_replace('_', '/', $class) . '.php';
|
|
}
|
|
Phar::mapPhar('monphar.phar');
|
|
include 'phar://monphar.phar/demarrage.php';
|
|
__HALT_COMPILER();");
|
|
$p->stopBuffering();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>Phar::stopBuffering</function></member>
|
|
<member><function>Phar::isBuffering</function></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
|
|
-->
|