[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Application/ -> DaemonApplication.php (summary)

Joomla! Content Management System

Copyright: (C) 2012 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 842 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 20 functions

  __construct()
  signal()
  isActive()
  loadConfiguration()
  execute()
  restart()
  stop()
  changeIdentity()
  daemonize()
  detach()
  fork()
  gc()
  setupSignalHandlers()
  shutdown()
  writeProcessIdFile()
  postFork()
  pcntlChildExitStatus()
  pcntlFork()
  pcntlSignal()
  pcntlWait()

Functions
Functions that are not part of a class:

__construct(Cli $input = null, Registry $config = null, DispatcherInterface $dispatcher = null)   X-Ref
Class constructor.

param: Cli                  $input       An optional argument to provide dependency injection for the application's
param: Registry             $config      An optional argument to provide dependency injection for the application's
param: DispatcherInterface  $dispatcher  An optional argument to provide dependency injection for the application's

signal($signal)   X-Ref
Method to handle POSIX signals.

param: integer  $signal  The received POSIX signal.
return: void

isActive()   X-Ref
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.

return: boolean  True if daemon is active.

loadConfiguration($data)   X-Ref
Load an object or array into the application configuration object.

param: mixed  $data  Either an array or object to be loaded into the configuration object.
return: DaemonApplication  Instance of $this to allow chaining.

execute()   X-Ref
Execute the daemon.

return: void

restart()   X-Ref
Restart daemon process.

return: void

stop()   X-Ref
Stop daemon process.

return: void

changeIdentity()   X-Ref
Method to change the identity of the daemon process and resources.

return: boolean  True if identity successfully changed

daemonize()   X-Ref
Method to put the application into the background.

return: boolean

detach()   X-Ref
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.

return: void

fork()   X-Ref
Method to fork the process.

return: integer  The child process id to the parent process, zero to the child process.

gc()   X-Ref
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.

return: void

setupSignalHandlers()   X-Ref
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.

return: boolean

shutdown($restart = false)   X-Ref
Method to shut down the daemon and optionally restart it.

param: boolean  $restart  True to restart the daemon on exit.
return: void

writeProcessIdFile()   X-Ref
Method to write the process id file out to disk.

return: boolean

postFork()   X-Ref
Method to handle post-fork triggering of the onFork event.

return: void

pcntlChildExitStatus($status)   X-Ref
Method to return the exit code of a terminated child process.

param: integer  $status  The status parameter is the status parameter supplied to a successful call to pcntl_waitpid().
return: integer  The child process exit code.

pcntlFork()   X-Ref
Method to return the exit code of a terminated child process.

return: integer  On success, the PID of the child process is returned in the parent's thread

pcntlSignal($signal, $handler, $restart = true)   X-Ref
Method to install a signal handler.

param: integer   $signal   The signal number.
param: callable  $handler  The signal handler which may be the name of a user created function,
param: boolean   $restart  Specifies whether system call restarting should be used when this
return: boolean  True on success.

pcntlWait(&$status, $options = 0)   X-Ref
Method to wait on or return the status of a forked child.

param: integer  &$status  Status information.
param: integer  $options  If wait3 is available on your system (mostly BSD-style systems),
return: integer  The process ID of the child which exited, -1 on error or zero if WNOHANG



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer