streams/Zotlabs/Daemon
2018-12-02 16:46:52 -08:00
..
Addon.php
Checksites.php
Cli_suggest.php
Cron.php Merge branch 'red' into dev 2018-09-18 20:51:38 -07:00
Cron_daily.php
Cron_weekly.php
Cronhooks.php
CurlAuth.php
Deliver.php
Deliver_hooks.php
Directory.php more photo object work 2018-10-28 21:01:58 -07:00
Expire.php
Externals.php issues with conversation completion which included AP messages 2018-12-02 16:46:52 -08:00
Gprobe.php typo 2018-08-27 19:09:48 -07:00
Importdoc.php
Importfile.php
Master.php
Notifier.php consistency in iconfig names 2018-11-21 19:04:42 -08:00
Onedirsync.php
Onepoll.php miscellaneous fixes, unset project icon, onepoll feed failure 2018-10-20 02:03:31 -07:00
Poller.php old protocol string still showing 2018-09-13 22:39:05 -07:00
Queue.php
README.md
Thumbnail.php
Xchan_photo.php set a process timeout for fetching remote xchan photos 2018-09-06 18:33:27 -07:00

Daemon (background) Processes

This directory provides background tasks which are executed by a command-line process and detached from normal web processing.

Background tasks are invoked by calling

Zotlabs\Daemon\Master::Summon([ $cmd, $arg1, $argn... ]); 

The Master class loads the desired command file and passes the arguments.

To create a background task 'Foo' use the following template.

<?php

namespace Zotlabs\Daemon;

class Foo {

	static public function run($argc,$argv) {
		// do something
	}
}

The Master class "summons" the command by creating an executable script from the provided arguments, then it invokes "Release" to execute the script detached from web processing. This process calls the static::run() function with any command line arguments using the traditional argc, argv format.

Please note: These are real $argc, $argv variables passed from the command line, and not the parsed argc() and argv() functions/variables which were obtained from parsing path components of the request URL by web processes.

Background processes do not emit displayable output except through logs. They should also not make any assumptions about their HTML and web environment (as they do not have a web environment), particularly with respect to global variables such as $_SERVER, $_REQUEST, $_GET, $_POST, $_COOKIES, and $_SESSION.