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


PHP Daemon::loadModuleIfAbsent方法代码示例

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


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

示例1: __construct

 /**
  * 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');
 }
开发者ID:shamahan,项目名称:phpdaemon,代码行数:16,代码来源:FileWatcher.php

示例2: init

 /**
  * Initialize FS driver
  * @return void
  */
 public static function init()
 {
     if (!Daemon::$config->eioenabled->value) {
         self::$supported = false;
         return;
     }
     if (!(self::$supported = Daemon::loadModuleIfAbsent('eio', self::$eioVer))) {
         Daemon::log('FS: missing pecl-eio >= ' . self::$eioVer . '. Filesystem I/O performance compromised. Consider installing pecl-eio. `pecl install http://pecl.php.net/get/eio`');
         return;
     }
     self::$fdCache = new CappedStorageHits(self::$fdCacheSize);
     eio_init();
 }
开发者ID:zenus,项目名称:phpinx,代码行数:17,代码来源:FileSystem.php

示例3: init

 /**
  * Actions on early startup.
  * @param string Optional. Config file path.
  * @return void
  */
 public static function init($configFile = null)
 {
     if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
         Daemon::log('PHP >= 5.4.0 required.');
         return;
     }
     //run without composer
     if (!function_exists('setTimeout')) {
         require 'PHPDaemon/Utils/func.php';
     }
     Daemon::initSettings();
     FileSystem::init();
     Daemon::$runName = basename($_SERVER['argv'][0]);
     $error = FALSE;
     $argv = $_SERVER['argv'];
     $runmode = isset($argv[1]) ? str_replace('-', '', $argv[1]) : '';
     $args = Bootstrap::getArgs($argv);
     if (!isset(self::$params[$runmode]) && !in_array($runmode, self::$commands)) {
         if ('' !== $runmode) {
             echo 'Unrecognized command: ' . $runmode . "\n";
         }
         self::printUsage();
         exit;
     } elseif ('help' === $runmode) {
         self::printHelp();
         exit;
     }
     $n = null;
     if ('log' === $runmode) {
         if (isset($args['n'])) {
             $n = $args['n'];
             unset($args['n']);
         } else {
             $n = 20;
         }
     }
     if (isset($configFile)) {
         Daemon::$config->configfile->setHumanValue($configFile);
     }
     if (isset($args['configfile'])) {
         Daemon::$config->configfile->setHumanValue($args['configfile']);
     }
     if (!Daemon::$config->loadCmdLineArgs($args)) {
         $error = true;
     }
     if (!Daemon::loadConfig(Daemon::$config->configfile->value)) {
         $error = true;
     }
     if ('log' === $runmode) {
         passthru('tail -n ' . $n . ' -f ' . escapeshellarg(Daemon::$config->logstorage->value));
         exit;
     }
     if (extension_loaded('apc') && ini_get('apc.enabled')) {
         Daemon::log('Detected pecl-apc extension enabled. Usage of bytecode caching (APC/eAccelerator/xcache/...)  makes no sense at all in case of using phpDaemon \'cause phpDaemon includes files just in time itself.');
     }
     if (isset(Daemon::$config->locale->value) && Daemon::$config->locale->value !== '') {
         setlocale(LC_ALL, array_map('trim', explode(',', Daemon::$config->locale->value)));
     }
     if (Daemon::$config->autoreimport->value && !is_callable('runkit_import')) {
         Daemon::log('[WARN] runkit extension not found. You should install it or disable --auto-reimport. Non-critical error.');
     }
     if (!is_callable('posix_kill')) {
         Daemon::log('[EMERG] Posix not found. You should compile PHP without \'--disable-posix\'.');
         $error = true;
     }
     if (!is_callable('pcntl_signal')) {
         Daemon::log('[EMERG] PCNTL not found. You should compile PHP with \'--enable-pcntl\'.');
         $error = true;
     }
     if (extension_loaded('libevent')) {
         Daemon::log('[EMERG] libevent extension found. You have to remove libevent.so extension.');
         $error = true;
     }
     $eventVer = '1.6.1';
     $eventVerType = 'stable';
     if (!Daemon::loadModuleIfAbsent('event', $eventVer . '-' . $eventVerType)) {
         Daemon::log('[EMERG] event extension >= ' . $eventVer . ' not found (or OUTDATED). You have to install it. `pecl install http://pecl.php.net/get/event`');
         $error = true;
     }
     if (!is_callable('socket_create')) {
         Daemon::log('[EMERG] Sockets extension not found. You should compile PHP with \'--enable-sockets\'.');
         $error = true;
     }
     if (!is_callable('shmop_open')) {
         Daemon::log('[EMERG] Shmop extension not found. You should compile PHP with \'--enable-shmop\'.');
         $error = true;
     }
     if (!isset(Daemon::$config->user)) {
         Daemon::log('[EMERG] You must set \'user\' parameter.');
         $error = true;
     }
     if (!isset(Daemon::$config->path)) {
         Daemon::log('[EMERG] You must set \'path\' parameter (path to your application resolver).');
         $error = true;
     }
//.........这里部分代码省略.........
开发者ID:shamahan,项目名称:phpdaemon,代码行数:101,代码来源:Bootstrap.php

示例4: setTitle

 /**
  * Sets a title of the current process
  * @param string Title
  * @param string $title
  * @return boolean Success
  */
 protected function setTitle($title)
 {
     if (is_callable('cli_set_process_title')) {
         return \cli_set_process_title($title);
     }
     if (Daemon::loadModuleIfAbsent('proctitle')) {
         return \setproctitle($title);
     }
     return false;
 }
开发者ID:cobolbaby,项目名称:phpdaemon,代码行数:16,代码来源:Generic.php


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