|
| __construct (Cli $input=null, Registry $config=null, DispatcherInterface $dispatcher=null) |
|
| isActive () |
|
| loadConfiguration ($data) |
|
| execute () |
|
| restart () |
|
| stop () |
|
| __construct (Input $input=null, Registry $config=null, CliOutput $output=null, CliInput $cliInput=null, DispatcherInterface $dispatcher=null, Container $container=null) |
|
| __get ($name) |
|
| getInput () |
|
| getLanguage () |
|
| execute () |
|
| getOutput () |
|
| getCliInput () |
|
| out ($text='', $nl=true) |
|
| in () |
|
| setOutput (CliOutput $output) |
|
| enqueueMessage ($msg, $type=self::MSG_INFO) |
|
| getMessageQueue () |
|
| isClient ($identifier) |
|
| getSession () |
|
| getConfig () |
|
| isCli () |
|
| __construct (Registry $config=null) |
|
| close ($code=0) |
|
| execute () |
|
| get ($key, $default=null) |
|
| getLogger () |
|
| set ($key, $value=null) |
|
| setConfiguration (Registry $config) |
|
| setLogger (LoggerInterface $logger) |
|
| setDispatcher (DispatcherInterface $dispatcher) |
|
| getIdentity () |
|
| getName () |
|
| loadIdentity (User $identity=null) |
|
| bootComponent ($component) |
|
| bootModule ($module, $applicationName) |
|
| bootPlugin ($plugin, $type) |
|
| getDispatcher () |
|
| triggerEvent ($eventName, $args=[]) |
|
Class to turn CliApplication applications into daemons. It requires CLI and PCNTL support built into PHP.
https://www.php.net/manual/en/features.commandline.php 1.7.0
◆ __construct()
Class constructor.
- Paramètres
-
Cli | $input | An optional argument to provide dependency injection for the application's input object. If the argument is a JInputCli object that object will become the application's input object, otherwise a default input object is created. |
Registry | $config | An optional argument to provide dependency injection for the application's config object. If the argument is a Registry object that object will become the application's config object, otherwise a default config object is created. |
DispatcherInterface | $dispatcher | An optional argument to provide dependency injection for the application's event dispatcher. If the argument is a DispatcherInterface object that object will become the application's event dispatcher, if it is null then the default event dispatcher will be created based on the application's loadDispatcher() method. |
- Depuis
- 1.7.0
Références $config, $input, Symfony\Contracts\Service\__construct(), Log\add(), Log\ERROR, et null.
◆ changeIdentity()
Method to change the identity of the daemon process and resources.
- Renvoie
- boolean True if identity successfully changed
- Depuis
- 1.7.0
- Voir également
- posix_setuid()
Références $info, $user, Log\add(), Log\ERROR, et Log\INFO.
◆ daemonize()
◆ detach()
This is truly where the magic happens. This is where we fork the process and kill the parent process, which is essentially what turns the application into a daemon.
- Renvoie
- void
- Depuis
- 3.0.0
- Exceptions
-
Références Log\add(), Log\DEBUG, et name.
◆ execute()
◆ fork()
Method to fork the process.
- Renvoie
- integer The child process id to the parent process, zero to the child process.
- Depuis
- 1.7.0
- Exceptions
-
Références Log\add(), Log\DEBUG, et elseif.
◆ gc()
Method to perform basic garbage collection and memory management in the sense of clearing the stat cache. We will probably call this method pretty regularly in our main loop.
- Renvoie
- void
- Depuis
- 1.7.0
◆ isActive()
Check to see if the daemon is active. This does not assume that $this daemon is active, but only if an instance of the application is active as a daemon.
- Renvoie
- boolean True if daemon is active.
- Depuis
- 1.7.0
Références Log\add(), et Log\WARNING.
◆ loadConfiguration()
loadConfiguration |
( |
|
$data | ) |
|
Load an object or array into the application configuration object.
- Paramètres
-
mixed | $data | Either an array or object to be loaded into the configuration object. |
- Renvoie
- DaemonApplication Instance of $this to allow chaining.
- Depuis
- 1.7.0
Références $name, $options, $this, $tmp, et null.
◆ pcntlChildExitStatus()
pcntlChildExitStatus |
( |
|
$status | ) |
|
|
protected |
Method to return the exit code of a terminated child process.
- Paramètres
-
integer | $status | The status parameter is the status parameter supplied to a successful call to pcntl_waitpid(). |
- Renvoie
- integer The child process exit code.
- Voir également
- pcntl_wexitstatus()
- Depuis
- 1.7.3
◆ pcntlFork()
Method to return the exit code of a terminated child process.
- Renvoie
- integer On success, the PID of the child process is returned in the parent's thread of execution, and a 0 is returned in the child's thread of execution. On failure, a -1 will be returned in the parent's context, no child process will be created, and a PHP error is raised.
- Voir également
- pcntl_fork()
- Depuis
- 1.7.3
◆ pcntlSignal()
pcntlSignal |
( |
|
$signal, |
|
|
|
$handler, |
|
|
|
$restart = true |
|
) |
| |
|
protected |
Method to install a signal handler.
- Paramètres
-
integer | $signal | The signal number. |
callable | $handler | The signal handler which may be the name of a user created function, or method, or either of the two global constants SIG_IGN or SIG_DFL. |
boolean | $restart | Specifies whether system call restarting should be used when this signal arrives. |
- Renvoie
- boolean True on success.
- Voir également
- pcntl_signal()
- Depuis
- 1.7.3
◆ pcntlWait()
pcntlWait |
( |
& |
$status, |
|
|
|
$options = 0 |
|
) |
| |
|
protected |
Method to wait on or return the status of a forked child.
- Paramètres
-
integer | &$status | Status information. |
integer | $options | If wait3 is available on your system (mostly BSD-style systems), you can provide the optional options parameter. |
- Renvoie
- integer The process ID of the child which exited, -1 on error or zero if WNOHANG was provided as an option (on wait3-available systems) and no child was available.
- Voir également
- pcntl_wait()
- Depuis
- 1.7.3
Références $options.
◆ postFork()
◆ restart()
◆ setupSignalHandlers()
Method to attach the DaemonApplication signal handler to the known signals. Applications can override these handlers by using the pcntl_signal() function and attaching a different callback method.
- Renvoie
- boolean
- Depuis
- 1.7.0
- Voir également
- pcntl_signal()
Références Log\add(), Log\DEBUG, Log\EMERGENCY, et null.
◆ shutdown()
shutdown |
( |
|
$restart = false | ) |
|
|
protected |
Method to shut down the daemon and optionally restart it.
- Paramètres
-
boolean | $restart | True to restart the daemon on exit. |
- Renvoie
- void
- Depuis
- 1.7.0
Références Log\add(), et Log\INFO.
◆ signal()
Method to handle POSIX signals.
- Paramètres
-
integer | $signal | The received POSIX signal. |
- Renvoie
- void
- Depuis
- 1.7.0
- Voir également
- pcntl_signal()
- Exceptions
-
Références Log\add(), class, Log\DEBUG, et Log\EMERGENCY.
◆ stop()
◆ writeProcessIdFile()
◆ $exiting
◆ $parentId
◆ $processId
◆ $running
◆ $signals
La documentation de cette classe a été générée à partir du fichier suivant :