本文整理汇总了PHP中Daemon::parseStoragepath方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::parseStoragepath方法的具体用法?PHP Daemon::parseStoragepath怎么用?PHP Daemon::parseStoragepath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Daemon
的用法示例。
在下文中一共展示了Daemon::parseStoragepath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
proc_nice(Daemon::$settings['masterpriority']);
gc_enable();
register_shutdown_function(array($this, 'onShutdown'));
$this->collections = array('workers' => new threadCollection());
Thread::setproctitle(Daemon::$runName . ': master process' . (Daemon::$settings['pidfile'] !== Daemon::$settings['defaultpidfile'] ? ' (' . Daemon::$settings['pidfile'] . ')' : ''));
Daemon::$appResolver = (require Daemon::$settings['path']);
Daemon::$appResolver->preloadPrivileged();
$this->spawnWorkers(min(Daemon::$settings['startworkers'], Daemon::$settings['maxworkers']));
$mpmLast = time();
$autoReloadLast = time();
while (TRUE) {
pcntl_signal_dispatch();
$this->sigwait(1, 0);
clearstatcache();
if (Daemon::$logpointerpath !== Daemon::parseStoragepath(Daemon::$settings['logstorage'])) {
$this->sigusr1();
}
$c = 1;
if (time() > $mpmLast + Daemon::$parsedSettings['mpmdelay']) {
$mpmLast = time();
++$c;
if ($c > 0xfffff) {
$c = 0;
}
if ($c % 10 == 0) {
$this->collections['workers']->removeTerminated(TRUE);
gc_collect_cycles();
} else {
$this->collections['workers']->removeTerminated();
}
if (isset(Daemon::$settings['mpm']) && is_callable($c = Daemon::$settings['mpm'])) {
call_user_func($c);
} else {
$state = Daemon::getStateOfWorkers($this);
if ($state) {
$n = max(min(Daemon::$settings['minspareworkers'] - $state['idle'], Daemon::$settings['maxworkers'] - $state['alive']), Daemon::$settings['minworkers'] - $state['alive']);
if ($n > 0) {
Daemon::log('Spawning ' . $n . ' worker(s).');
$this->spawnWorkers($n);
}
$n = min($state['idle'] - Daemon::$settings['maxspareworkers'], $state['alive'] - Daemon::$settings['minworkers']);
if ($n > 0) {
Daemon::log('Stopping ' . $n . ' worker(s).');
$this->stopWorkers($n);
}
}
}
}
}
}
示例2: openLogs
public static function openLogs()
{
if (Daemon::$settings['logging']) {
if (Daemon::$logpointer) {
fclose(Daemon::$logpointer);
Daemon::$logpointer = FALSE;
}
Daemon::$logpointer = fopen(Daemon::$logpointerpath = Daemon::parseStoragepath(Daemon::$settings['logstorage']), 'a+');
if (isset(Daemon::$settings['group'])) {
chgrp(Daemon::$logpointerpath, Daemon::$settings['group']);
}
if (isset(Daemon::$settings['user'])) {
chown(Daemon::$logpointerpath, Daemon::$settings['user']);
}
}
}