当前位置: 首页>>代码示例>>PHP>>正文


PHP Daemon::appResolverPath方法代码示例

本文整理汇总了PHP中PHPDaemon\Core\Daemon::appResolverPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::appResolverPath方法的具体用法?PHP Daemon::appResolverPath怎么用?PHP Daemon::appResolverPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPDaemon\Core\Daemon的用法示例。


在下文中一共展示了Daemon::appResolverPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init


//.........这里部分代码省略.........
         Daemon::log('[EMERG] You must set \'path\' parameter (path to your application resolver).');
         $error = true;
     }
     if (!file_exists(Daemon::$config->pidfile->value)) {
         if (!touch(Daemon::$config->pidfile->value)) {
             Daemon::log('[EMERG] Couldn\'t create pid-file \'' . Daemon::$config->pidfile->value . '\'.');
             $error = true;
         }
         Bootstrap::$pid = 0;
     } elseif (!is_file(Daemon::$config->pidfile->value)) {
         Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be a regular file.');
         Bootstrap::$pid = FALSE;
         $error = true;
     } elseif (!is_writable(Daemon::$config->pidfile->value)) {
         Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be writable.');
         $error = true;
     } elseif (!is_readable(Daemon::$config->pidfile->value)) {
         Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be readable.');
         Bootstrap::$pid = FALSE;
         $error = true;
     } else {
         Bootstrap::$pid = (int) file_get_contents(Daemon::$config->pidfile->value);
     }
     if (Daemon::$config->chroot->value !== '/') {
         if (posix_getuid() != 0) {
             Daemon::log('You must have the root privileges to change root.');
             $error = true;
         }
     }
     $pathList = preg_split('~\\s*;\\s*~', Daemon::$config->path->value);
     $found = false;
     foreach ($pathList as $path) {
         if (@is_file($path)) {
             Daemon::$appResolverPath = $path;
             $found = true;
             break;
         }
     }
     if (!$found) {
         Daemon::log('Your application resolver \'' . Daemon::$config->path->value . '\' is not available (config directive \'path\').');
         $error = true;
     }
     Daemon::$appResolver = (require Daemon::$appResolverPath);
     if (isset(Daemon::$config->group->value) && is_callable('posix_getgid')) {
         if (($sg = posix_getgrnam(Daemon::$config->group->value)) === FALSE) {
             Daemon::log('Unexisting group \'' . Daemon::$config->group->value . '\'. You have to replace config-variable \'group\' with existing group-name.');
             $error = true;
         } elseif ($sg['gid'] != posix_getgid() && posix_getuid() != 0) {
             Daemon::log('You must have the root privileges to change group.');
             $error = true;
         }
     }
     if (isset(Daemon::$config->user->value) && is_callable('posix_getuid')) {
         if (($su = posix_getpwnam(Daemon::$config->user->value)) === FALSE) {
             Daemon::log('Unexisting user \'' . Daemon::$config->user->value . '\', user not found. You have to replace config-variable \'user\' with existing username.');
             $error = true;
         } elseif ($su['uid'] != posix_getuid() && posix_getuid() != 0) {
             Daemon::log('You must have the root privileges to change user.');
             $error = true;
         }
     }
     if (isset(Daemon::$config->minspareworkers->value) && Daemon::$config->minspareworkers->value > 0 && isset(Daemon::$config->maxspareworkers->value) && Daemon::$config->maxspareworkers->value > 0) {
         if (Daemon::$config->minspareworkers->value > Daemon::$config->maxspareworkers->value) {
             Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
             $error = true;
         }
开发者ID:shamahan,项目名称:phpdaemon,代码行数:67,代码来源:Bootstrap.php


注:本文中的PHPDaemon\Core\Daemon::appResolverPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。