This repository has been archived on 2024-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
core/Zotlabs/Daemon
2018-05-30 14:09:24 +02:00
..
Addon.php
Checksites.php
Cli_suggest.php
Cron_daily.php
Cron_weekly.php
Cron.php
Cronhooks.php
CurlAuth.php
Deliver_hooks.php
Deliver.php we probably don't need to delivery local items more than once 2018-05-28 22:23:40 -07:00
Directory.php
Expire.php last commented expiration setting in admin 2018-04-10 00:05:20 -07:00
Externals.php
Gprobe.php
Importdoc.php
Importfile.php
Master.php
Notifier.php copy/paste error resulting in bad behaviour 2018-02-20 14:41:46 -08:00
Onedirsync.php
Onepoll.php
Poller.php just query for data we actually need 2018-05-30 14:09:24 +02:00
Queue.php fix manual queue invocation (was using the web argc/argv from the cli) 2018-02-05 16:08:01 -08:00
Ratenotif.php
README.md
Thumbnail.php add thumbnail hook 2017-11-21 17:56:23 -08: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.