|
| __construct (\JInputCli $input=null, Registry $config=null, \JEventDispatcher $dispatcher=null) |
|
| isActive () |
|
| loadConfiguration ($data) |
|
| execute () |
|
| restart () |
|
| stop () |
|
| __construct (Cli $input=null, Registry $config=null, \JEventDispatcher $dispatcher=null) |
|
| execute () |
|
| loadConfiguration ($data) |
|
| out ($text='', $nl=true) |
|
| getOutput () |
|
| setOutput (CliOutput $output) |
|
| in () |
|
| __construct (Input $input=null, Registry $config=null) |
|
| getIdentity () |
|
| registerEvent ($event, $handler) |
|
| triggerEvent ($event, array $args=null) |
|
| loadDispatcher (\JEventDispatcher $dispatcher=null) |
|
| loadIdentity (\JUser $identity=null) |
|
| __construct (Input $input=null, Registry $config=null) |
|
| close ($code=0) |
|
| execute () |
|
| get ($key, $default=null) |
|
| getLogger () |
|
| set ($key, $value=null) |
|
| setConfiguration (Registry $config) |
|
| setLogger (LoggerInterface $logger) |
|
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
-
\JInputCli | $input | An optional argument to provide dependency injection for the application's input object. If the argument is a 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. |
\JEventDispatcher | $dispatcher | An optional argument to provide dependency injection for the application's event dispatcher. If the argument is a 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
- Exceptions
-
Références $config, $dispatcher, $input, 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 $file, $info, et $user.
◆ daemonize()
Method to put the application into the background.
- Renvoie
- boolean
- Depuis
- 1.7.0
- Exceptions
-
Références name.
◆ 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 name.
◆ execute()
Execute the daemon.
- Renvoie
- void
- Depuis
- 1.7.0
Références name.
◆ 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 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
◆ 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 $data, $name, $options, $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()
Method to handle post-fork triggering of the onFork event.
- Renvoie
- void
- Depuis
- 3.0.0
◆ restart()
Restart daemon process.
- Renvoie
- void
- Depuis
- 1.7.0
Références name.
◆ 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 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 $GLOBALS.
◆ 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
-
◆ stop()
Stop daemon process.
- Renvoie
- void
- Depuis
- 1.7.0
Références name.
◆ writeProcessIdFile()
Method to write the process id file out to disk.
- Renvoie
- boolean
- Depuis
- 1.7.0
Références $file, et $folder.
◆ $exiting
◆ $parentId
◆ $processId
◆ $running
◆ $signals
La documentation de cette classe a été générée à partir du fichier suivant :