/libraries/joomla/application/daemon.php

Description
  • copyright: Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  • license: GNU
Classes
Class Description
JApplicationDaemon Base class for a Joomla! command line application.
Functions
changeIdentity (line 426)

Method to change the identity of the daemon process and resources.

  • return: True if identity successfully changed
  • see: posix_setuid()
  • since: 11.1
boolean changeIdentity ()
daemonize (line 486)

Method to put the application into the background.

  • throws: RuntimeException
  • since: 11.1
boolean daemonize ()
detach (line 565)

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: RuntimeException
  • since: 12.1
void detach ()
fork (line 596)

Method to fork the process.

  • return: The child process id to the parent process, zero to the child process.
  • throws: RuntimeException
  • since: 11.1
integer fork ()
gc (line 633)

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: 11.1
void gc ()
isActive (line 212)

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: True if daemon is active.
  • since: 11.1
boolean isActive ()
loadConfiguration (line 257)

Load an object or array into the application configuration object.

  • return: Instance of $this to allow chaining.
  • since: 11.1
JCli loadConfiguration (mixed $data)
  • mixed $data: Either an array or object to be loaded into the configuration object.
pcntlChildExitStatus (line 801)

Method to return the exit code of a terminated child process.

  • return: The child process exit code.
  • see: pcntl_wexitstatus()
  • since: 11.3
integer pcntlChildExitStatus (integer $status)
  • integer $status: The status parameter is the status parameter supplied to a successful call to pcntl_waitpid().
pcntlFork (line 818)

Method to return the exit code of a terminated child process.

  • return: 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.
  • see: pcntl_fork()
  • since: 11.3
integer pcntlFork ()
pcntlSignal (line 838)

Method to install a signal handler.

  • return: True on success.
  • see: pcntl_signal()
  • since: 11.3
boolean pcntlSignal (integer $signal, callback $handler, [boolean $restart = true])
  • integer $signal: The signal number.
  • callback $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.
pcntlWait (line 857)

Method to wait on or return the status of a forked child.

  • return: 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.
  • see: pcntl_wait()
  • since: 11.3
integer pcntlWait (integer &$status, [integer $options = 0])
  • integer &$status: Status information.
  • integer $options: If wait3 is available on your system (mostly BSD-style systems), you can provide the optional options parameter.
postFork (line 784)

Method to handle post-fork triggering of the onFork event.

  • since: 12.1
void postFork ()
restart (line 354)

Restart daemon process.

  • since: 11.1
void restart ()
setupSignalHandlers (line 655)

Method to attach the JApplicationDaemon signal handler to the known signals. Applications can override these handlers by using the pcntl_signal() function and attaching a different callback method.

  • see: pcntl_signal()
  • since: 11.1
boolean setupSignalHandlers ()
shutdown (line 686)

Method to shut down the daemon and optionally restart it.

  • since: 11.1
void shutdown ([boolean $restart = false])
  • boolean $restart: True to restart the daemon on exit.
start (line 367)

Spawn daemon process.

  • since: 11.1
void start ()
stop (line 412)

Stop daemon process.

  • since: 11.1
void stop ()
writeProcessIdFile (line 735)

Method to write the process id file out to disk.

  • since: 11.1
boolean writeProcessIdFile ()

Documentation generated on Mon, 25 Jun 2012 13:53:57 -0500 by phpDocumentor 1.4.4