public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=')
{
if (!extension_loaded($mod)) {
if (!get_cfg_var('enable_dl')) {
return false;
}
if (!@dl(basename($mod) . '.so')) {
return false;
}
}
if (!$version) {
return true;
}
try {
$ext = new \ReflectionExtension($mod);
return version_compare($ext->getVersion(), $version, $compare);
} catch (\ReflectionException $e) {
return false;
}
}
/** * Constructor */ public function __construct() { if (Daemon::loadModuleIfAbsent('inotify')) { $this->inotify = inotify_init(); stream_set_blocking($this->inotify, 0); } Timer::add(function ($event) { Daemon::$process->fileWatcher->watch(); if (sizeof(Daemon::$process->fileWatcher->files) > 0) { $event->timeout(); } }, 1000000.0 * 1, 'fileWatcher'); }