PHP Class PHPDaemon\Core\Daemon

Author: Zorin Vasily ([email protected])
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
Afficher le fichier Open project: kakserpom/phpdaemon Class Usage Examples

Méthodes publiques

Свойство Type Description
$appInstances array Running application instances
$appResolver AppResolver AppResolver
$appResolverPath string Path to application resolver
$compatMode boolean Running under Apache/PHP-FPM in compatibility mode?
$config PHPDaemon\Config\Object Configuration object
$context object Running context
$defaultErrorLevel integer Default error reporting level
$logpointer resource Log file resource
$logpointerAsync object Log file async. resource
$noError boolean Mechanism of catching errors. Set it to true, then run your suspect code, and then check this property again. If false, there was error message.
$obInStack boolean Whether if the current execution stack contains ob-filter
$process PHPDaemon\Thread\Master | PHPDaemon\Thread\IPC | PHPDaemon\Thread\Worker Current thread object
$req PHPDaemon\Request\Generic Running request
$restrictErrorControl boolean Restrict error control. When true, operator '@' means nothing.
$runName string Base name of daemon instance
$runworkerMode boolean Is it running under master-less 'runworker' mode?
$shm_wstate PHPDaemon\Thread\Collection Shared memory 'WSTATE' entity
$startTime integer PHPDaemon start time
$version string PHPDaemon version
$wstateRev array Hash of possible worker states

Protected Properties

Свойство Type Description
$initservervar array Copy of $_SERVER on the daemon start
$masters PHPDaemon\Thread\Collection Collection of masters
$support string Supported things array
$workers PHPDaemon\Thread\Collection Collection of workers

Méthodes publiques

Méthode Description
callAutoGC ( ) : void Call automatic garbage collector
checkAutoGC ( ) : boolean Check if we need to run automatic garbage collector
compatRunEmul ( ) : boolean | null It allows to run your simple web-apps in spawn-fcgi/php-fpm environment.
errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline, array $errcontext ) Error handler
getStateOfWorkers ( ) : array Get state of workers.
glob ( string $pattern, integer $flags ) : array Glob function with support of include_path
init ( ) : void Performs initial actions.
initSettings ( ) : void Loads default setting.
lintFile ( $filename ) : boolean Check file syntax via runkit_lint_file if supported or via php -l
loadConfig ( string $paths ) : boolean Load config-file
loadModuleIfAbsent ( string $mod, string $version = null, string $compare = '>=' ) : boolean Load PHP extension (module) if absent
log ( $args ) Send message to the log
openLogs ( ) : void Open logs
outputFilter ( $s ) : string Output filter
runWorker ( ) : void Run worker thread
spawnMaster ( ) : null | integer Spawn a master process
supported ( integer $what ) : boolean Is thing supported
uncaughtExceptionHandler ( Exception $e ) : void Uncaught exception handler
uniqid ( ) : string Generate a unique ID.

Méthodes protégées

Méthode Description
checkSupports ( ) : void Method to fill $support array

Method Details

callAutoGC() public static méthode

Call automatic garbage collector
public static callAutoGC ( ) : void
Résultat void

checkAutoGC() public static méthode

Check if we need to run automatic garbage collector
public static checkAutoGC ( ) : boolean
Résultat boolean

checkSupports() protected static méthode

Method to fill $support array
protected static checkSupports ( ) : void
Résultat void

compatRunEmul() public static méthode

It allows to run your simple web-apps in spawn-fcgi/php-fpm environment.
public static compatRunEmul ( ) : boolean | null
Résultat boolean | null - Success.

errorHandler() public static méthode

Error handler
public static errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline, array $errcontext )
$errno integer
$errstr string
$errfile string
$errline integer
$errcontext array

getStateOfWorkers() public static méthode

Get state of workers.
public static getStateOfWorkers ( ) : array
Résultat array - information.

glob() public static méthode

Glob function with support of include_path
public static glob ( string $pattern, integer $flags ) : array
$pattern string
$flags integer
Résultat array

init() public static méthode

Performs initial actions.
public static init ( ) : void
Résultat void

initSettings() public static méthode

Loads default setting.
public static initSettings ( ) : void
Résultat void

lintFile() public static méthode

Check file syntax via runkit_lint_file if supported or via php -l
public static lintFile ( $filename ) : boolean
Résultat boolean

loadConfig() public static méthode

Load config-file
public static loadConfig ( string $paths ) : boolean
$paths string Path
Résultat boolean - Success.

loadModuleIfAbsent() public static méthode

Load PHP extension (module) if absent
public static loadModuleIfAbsent ( string $mod, string $version = null, string $compare = '>=' ) : boolean
$mod string
$version string
$compare string
Résultat boolean $success

log() public static méthode

Send message to the log
public static log ( $args )
$args

openLogs() public static méthode

Open logs
public static openLogs ( ) : void
Résultat void

outputFilter() public static méthode

Output filter
public static outputFilter ( $s ) : string
Résultat string Output

runWorker() public static méthode

Run worker thread
public static runWorker ( ) : void
Résultat void

spawnMaster() public static méthode

Spawn a master process
public static spawnMaster ( ) : null | integer
Résultat null | integer - success

supported() public static méthode

Is thing supported
public static supported ( integer $what ) : boolean
$what integer Thing to check
Résultat boolean

uncaughtExceptionHandler() public static méthode

Uncaught exception handler
public static uncaughtExceptionHandler ( Exception $e ) : void
$e Exception
Résultat void

uniqid() public static méthode

Generate a unique ID.
public static uniqid ( ) : string
Résultat string Returns the unique identifier, as a string.

Property Details

$appInstances public_oe static_oe property

Running application instances
public static array $appInstances
Résultat array

$appResolver public_oe static_oe property

AppResolver
public static AppResolver,PHPDaemon\Core $appResolver
Résultat AppResolver

$appResolverPath public_oe static_oe property

Path to application resolver
public static string $appResolverPath
Résultat string

$compatMode public_oe static_oe property

Running under Apache/PHP-FPM in compatibility mode?
public static bool $compatMode
Résultat boolean

$config public_oe static_oe property

Configuration object
public static Object,PHPDaemon\Config $config
Résultat PHPDaemon\Config\Object

$context public_oe static_oe property

Running context
public static object $context
Résultat object

$defaultErrorLevel public_oe static_oe property

Default error reporting level
public static int $defaultErrorLevel
Résultat integer

$initservervar protected_oe static_oe property

Copy of $_SERVER on the daemon start
protected static array $initservervar
Résultat array

$logpointer public_oe static_oe property

Log file resource
public static resource $logpointer
Résultat resource

$logpointerAsync public_oe static_oe property

Log file async. resource
public static object $logpointerAsync
Résultat object

$masters protected_oe static_oe property

Collection of masters
protected static Collection,PHPDaemon\Thread $masters
Résultat PHPDaemon\Thread\Collection

$noError public_oe static_oe property

Mechanism of catching errors. Set it to true, then run your suspect code, and then check this property again. If false, there was error message.
public static bool $noError
Résultat boolean

$obInStack public_oe static_oe property

Whether if the current execution stack contains ob-filter
public static bool $obInStack
Résultat boolean

$process public_oe static_oe property

Current thread object
public static Master,PHPDaemon\Thread|IPC,PHPDaemon\Thread|Worker,PHPDaemon\Thread $process
Résultat PHPDaemon\Thread\Master | PHPDaemon\Thread\IPC | PHPDaemon\Thread\Worker

$req public_oe static_oe property

Running request
public static Generic,PHPDaemon\Request $req
Résultat PHPDaemon\Request\Generic

$restrictErrorControl public_oe static_oe property

Restrict error control. When true, operator '@' means nothing.
public static bool $restrictErrorControl
Résultat boolean

$runName public_oe static_oe property

Base name of daemon instance
public static string $runName
Résultat string

$runworkerMode public_oe static_oe property

Is it running under master-less 'runworker' mode?
public static bool $runworkerMode
Résultat boolean

$shm_wstate public_oe static_oe property

Shared memory 'WSTATE' entity
public static Collection,PHPDaemon\Thread $shm_wstate
Résultat PHPDaemon\Thread\Collection

$startTime public_oe static_oe property

PHPDaemon start time
public static int $startTime
Résultat integer

$support protected_oe static_oe property

Supported things array
protected static string $support
Résultat string

$version public_oe static_oe property

PHPDaemon version
public static string $version
Résultat string

$workers protected_oe static_oe property

Collection of workers
protected static Collection,PHPDaemon\Thread $workers
Résultat PHPDaemon\Thread\Collection

$wstateRev public_oe static_oe property

Hash of possible worker states
public static array $wstateRev
Résultat array