array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'evstat.construct.php', 1 => 'EvStat::__construct', ), 'up' => array ( 0 => 'class.evstat.php', 1 => 'EvStat', ), 'prev' => array ( 0 => 'evstat.attr.php', 1 => 'EvStat::attr', ), 'next' => array ( 0 => 'evstat.createstopped.php', 1 => 'EvStat::createStopped', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/ev/evstat/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ev >= 0.2.0)
EvStat::__construct — Construit un objet EvStat watcher
$path
,$interval
,$callback
,$data
= null
,$priority
= 0
Construit un objet EvStat watcher et démarre le watcher automatiquement.
path
Le chemin pour lequel on attend un modification de statut.
interval
Intervalle de détection d'une modification ; doit valoir normalement
0.0
pour laisser libev
choisir la bonne valeur.
callback
Voir les fonctions de rappel Watcher.
data
Données personnalisées à associer avec le watcher.
priority
Exemple #1 Sruveillance des modifications dans le dossier /var/log/messages
<?php
// Utilisation d'un intervalle de 10 secondes.
$w = new EvStat("/var/log/messages", 10, function ($w) {
echo "/var/log/messages changed\n";
$attr = $w->attr();
if ($attr['nlink']) {
printf("Current size: %ld\n", $attr['size']);
printf("Current atime: %ld\n", $attr['atime']);
printf("Current mtime: %ld\n", $attr['mtime']);
} else {
fprintf(STDERR, "`messages` file is not there!");
$w->stop();
}
});
?>