public
|
#
__construct( Joomla\Application\Cli $input = null, Joomla\Registry\Registry $config = null, Joomla\Application\Cli\CliOutput $output = null, Joomla\Application\Cli\CliInput $cliInput = null )
Class constructor.
Parameters
- $input
Joomla\Input\Cli - $input An optional argument to provide dependency injection for the
application's input object. If the argument is an Input\Cli object that object
will become the application's input object, otherwise a default input object is
created.
- $config
Joomla\Registry\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.
- $output
Joomla\Application\Cli\CliOutput - $output An optional argument to provide dependency injection for the
application's output object. If the argument is a Cli\CliOutput object that
object will become the application's input object, otherwise a default output
object is created.
- $cliInput
Joomla\Application\Cli\CliInput - $cliInput An optional argument to provide dependency injection for the
application's CLI input object. If the argument is a Cli\CliInput object that
object will become the application's input object, otherwise a default input
object is created.
Since
1.0
Overrides
|
public
|
#
signal( integer $signal )
Method to handle POSIX signals.
Method to handle POSIX signals.
Parameters
- $signal
integer - $signal The received POSIX signal.
Throws
Since
1.0
See
pcntl_signal()
|
public
boolean
|
#
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.
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.
Returns
boolean - True if daemon is active.
Since
1.0
|
public
Joomla\Application\AbstractDaemonApplication
|
#
loadConfiguration( mixed $data )
Load an object or array into the application configuration object.
Load an object or array into the application configuration object.
Parameters
- $data
mixed - $data Either an array or object to be loaded into the configuration object.
Returns
Since
1.0
|
public
|
#
execute( )
Execute the daemon.
Since
1.0
Overrides
|
public
|
#
restart( )
Restart daemon process.
Since
1.0
CodeCoverageIgnore
|
public
|
#
stop( )
Stop daemon process.
Since
1.0
CodeCoverageIgnore
|
protected
boolean
|
#
changeIdentity( )
Method to change the identity of the daemon process and resources.
Method to change the identity of the daemon process and resources.
Returns
boolean - True if identity successfully changed
Since
1.0
See
posix_setuid()
|
protected
boolean
|
#
daemonize( )
Method to put the application into the background.
Method to put the application into the background.
Returns
boolean
Throws
Since
1.0
|
protected
|
#
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.
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.
Throws
Since
1.0
|
protected
integer
|
#
fork( )
Method to fork the process.
Method to fork the process.
Returns
integer - The child process id to the parent process, zero to the child process.
Throws
Since
1.0
|
protected
|
#
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.
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.
Since
1.0
CodeCoverageIgnore
|
protected
boolean
|
#
setupSignalHandlers( )
Method to attach the AbstractDaemonApplication signal handler to the known
signals. Applications can override these handlers by using the pcntl_signal()
function and attaching a different callback method.
Method to attach the AbstractDaemonApplication signal handler to the known
signals. Applications can override these handlers by using the pcntl_signal()
function and attaching a different callback method.
Returns
boolean
Since
1.0
See
pcntl_signal()
|
protected
|
#
shutdown( boolean $restart = false )
Method to shut down the daemon and optionally restart it.
Method to shut down the daemon and optionally restart it.
Parameters
- $restart
boolean - $restart True to restart the daemon on exit.
Since
1.0
|
protected
boolean
|
#
writeProcessIdFile( )
Method to write the process id file out to disk.
Method to write the process id file out to disk.
Returns
boolean
Since
1.0
|
protected
|
#
postFork( )
Method to handle post-fork triggering of the onFork event.
Method to handle post-fork triggering of the onFork event.
Since
1.0
|
protected
integer
|
#
pcntlChildExitStatus( integer $status )
Method to return the exit code of a terminated child process.
Method to return the exit code of a terminated child process.
Parameters
- $status
integer - $status The status parameter is the status parameter supplied to a successful
call to pcntl_waitpid().
Returns
integer - The child process exit code.
Since
1.0
See
pcntl_wexitstatus()
CodeCoverageIgnore
|
protected
integer
|
#
pcntlFork( )
Method to return the exit code of a terminated child process.
Method to return the exit code of a terminated child process.
Returns
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.
Since
1.0
See
pcntl_fork()
CodeCoverageIgnore
|
protected
boolean
|
#
pcntlSignal( integer $signal, callable $handler, boolean $restart = true )
Method to install a signal handler.
Method to install a signal handler.
Parameters
- $signal
integer - $signal The signal number.
- $handler
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.
- $restart
boolean - $restart Specifies whether system call restarting should be used when this
signal arrives.
Returns
boolean - True on success.
Since
1.0
See
pcntl_signal()
CodeCoverageIgnore
|
protected
integer
|
#
pcntlWait( integer & $status, integer $options = 0 )
Method to wait on or return the status of a forked child.
Method to wait on or return the status of a forked child.
Parameters
- $status
integer - &$status Status information.
- $options
integer - $options If wait3 is available on your system (mostly BSD-style systems), you
can provide the optional options parameter.
Returns
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.
Since
1.0
See
pcntl_wait()
CodeCoverageIgnore
|