1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-25 16:22:18 +01:00
Files
archived-doc-ru/reference/ev/evstat/construct.xml
Mikhail Alferov ebff5adf4d Updated to English (#963)
* Update constants.xml

* Update new-features.xml

* Update book.xml

* Update evstat.xml

* Update construct.xml

* Update ini.xml

* Update book.xml

* Update controls.xml

* Update ldap-exop.xml

* Update pattern.modifiers.xml

* Update pattern.modifiers.xml

* Update construct.xml

* Update construct.xml

* Update sodium-crypto-pwhash.xml

* Update book.xml

* Update close.xml

* Update getarchiveflag.xml

* Update open.xml

* Update setarchiveflag.xml
2024-03-18 09:45:48 +03:00

154 lines
4.1 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: dbbabb929e755cceddb63908e7d2cbc3d161c0d3 Maintainer: sergey Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="evstat.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvStat::__construct</refname>
<refpurpose>Создаёт объект наблюдателя EvStat</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis>
<modifier>public</modifier>
<methodname>EvStat::__construct</methodname>
<methodparam>
<type>string</type>
<parameter>path</parameter>
</methodparam>
<methodparam>
<type>float</type>
<parameter>interval</parameter>
</methodparam>
<methodparam>
<type>callable</type>
<parameter>callback</parameter>
</methodparam>
<methodparam
choice="opt">
<type>mixed</type>
<parameter>data</parameter>
<initializer>&null;</initializer>
</methodparam>
<methodparam
choice="opt">
<type>int</type>
<parameter>priority</parameter>
<initializer>0</initializer>
</methodparam>
</constructorsynopsis>
<para>
Метод создаёт объект наблюдателя EvStat и автоматически запускает наблюдателя.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term>
<parameter>path</parameter>
</term>
<listitem>
<para>
Путь для ожидания изменения статуса.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>interval</parameter>
</term>
<listitem>
<para>
Подсказка о том, как быстро ожидается обнаружение изменений.
Для интервала лучше указать значение <literal>0.0</literal>,
чтобы модуль <emphasis>libev</emphasis> сам выбирал подходящее значение.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>callback</parameter>
</term>
<listitem>
<para>
Смотрите
<link linkend="ev.watcher-callbacks">Наблюдатели обратного вызова</link>
.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>data</parameter>
</term>
<listitem>
<para>
Пользовательские данные, связанные с наблюдателем.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>priority</parameter>
</term>
<listitem>
<para>
<link linkend="ev.constants.watcher-pri">Приоритет наблюдателя</link>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Смотрим изменения в /var/log/messages</title>
<programlisting role="php">
<![CDATA[
<?php
// Используем 10-секундный интервал обновления.
$w = new EvStat("/var/log/messages", 10, function ($w) {
echo "/var/log/messages изменён\n";
$attr = $w->attr();
if ($attr['nlink']) {
printf("Размер: %ld\n", $attr['size']);
printf("Время просмотра: %ld\n", $attr['atime']);
printf("Время изменения: %ld\n", $attr['mtime']);
} else {
fprintf(STDERR, "`messages` файл не найден!");
$w->stop();
}
});
?>
]]>
</programlisting>
</example>
</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
-->