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
2017-05-01 15:14:25 +02:00
..
Addon.php daemon_addon hook - lets plugins create custom background processes. 2017-01-17 00:14:47 -08:00
Checksites.php consolidate hubloc storage 2017-01-30 15:01:22 -08:00
Cli_suggest.php
Cron_daily.php expire unread system notifications after a year. It would provide a better experience for infrequent visitors if we didn't expire them at all, but at some point we need to draw a line so as not to degrade system performance searching through old notifications that it's highly unlikely will ever be viewed again. 2017-02-28 14:56:26 -08:00
Cron_weekly.php consolidate hubloc storage 2017-01-30 15:01:22 -08:00
Cron.php perform attach_upgrade() 2017-03-29 14:04:44 +02:00
Cronhooks.php
CurlAuth.php still working through some issues with curl magic-auth 2016-06-27 22:25:37 -07:00
Deliver_hooks.php
Deliver.php
Directory.php
Expire.php expire crashing on shared hosting from memory exhaustion. Lower the expire limit. Also the sys channel was being expired with everybody else due to a flag change regression. 2016-07-06 22:02:06 -07:00
Externals.php null_date conversion; phase 1 2016-09-25 17:06:13 -07:00
Gprobe.php
Importdoc.php
Master.php [FEATURE] Add config and use composer autoloader. 2016-10-18 18:11:41 +02:00
Notifier.php Revert "fix the query of last pullrequest" 2017-04-24 09:05:33 +02:00
Onedirsync.php
Onepoll.php use hostname, not url 2017-05-01 15:14:25 +02:00
Poller.php null_date conversion; phase 1 2016-09-25 17:06:13 -07:00
Queue.php no quotes on dbutcnow() output 2017-01-29 16:33:30 -08:00
Ratenotif.php zot 1.2 2016-11-30 16:22:31 -08:00
README.md

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.