DTux
/
dtux__moha
Archived
1
0
Fork 0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__moha/configWatch.php

35 lines
740 B
PHP

<?php
$cwfd = inotify_init();
if ($cwfd !== false)
{
$watch_descriptor = inotify_add_watch($cwfd, $configDir, IN_CLOSE_WRITE | IN_MODIFY | IN_MOVE);
logger(ERROR, _("configWatchInit : Inotify retourne 'false'"), __FILE__ . ":" . __LINE__);
}
function configWatchInit()
{
global $cwfd;
logger(DEBUG, _("configWatchInit : Initialise la surveillance du dossier des configurations"), __FILE__ . ":" . __LINE__);
if ($cwfd !== false)
{
$read = array($cwfd);
$write = null;
$except = null;
stream_select($read, $write, $except,0);
stream_set_blocking($cwfd, 0);
}
}
function configWatchStop()
{
// stop la surveillance
inotify_rm_watch($cwfd, $watch_descriptor);
// Destruction de l'instance inotify
fclose($cwfd);
}
?>