daemon_addon hook - lets plugins create custom background processes.
This commit is contained in:
parent
8478ecc675
commit
335d9af8dc
14
Zotlabs/Daemon/Addon.php
Normal file
14
Zotlabs/Daemon/Addon.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Daemon;
|
||||||
|
|
||||||
|
require_once('include/zot.php');
|
||||||
|
|
||||||
|
class Addon {
|
||||||
|
|
||||||
|
static public function run($argc,$argv) {
|
||||||
|
|
||||||
|
call_hooks('daemon_addon',$argv);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
15
doc/hook/daemon_addon.bb
Normal file
15
doc/hook/daemon_addon.bb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[h2]daemon_addon[/h2]
|
||||||
|
|
||||||
|
|
||||||
|
A foreground plugin can create a background process by invoking:
|
||||||
|
|
||||||
|
[code]
|
||||||
|
\Zotlabs\Daemon\Master::Summon([ 'Addon', 'myplugin', 'something' ]);
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
This starts up a background process (called 'Addon') specifically for addons to use.
|
||||||
|
|
||||||
|
Then if your plugin is also catching the daemon_addon hook that handler will be called with the
|
||||||
|
argv array of the background process. In this case [ 'myplugin', 'something' ];
|
||||||
|
|
||||||
|
We recommend using this convention so that plugins can share this hook without causing conflicts; that is check to see if your plugin is the first array argument and if not, return from the hook. Otherwise you can initiate background processing. Something to remember is that during background processes there is no session. You are detached from the web page which created the background process.
|
@ -148,6 +148,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
|
|||||||
[zrl=[baseurl]/help/hook/crypto_methods]crypto_methods[/zrl]
|
[zrl=[baseurl]/help/hook/crypto_methods]crypto_methods[/zrl]
|
||||||
Called when generating a list of crypto algorithms in the locally preferred order
|
Called when generating a list of crypto algorithms in the locally preferred order
|
||||||
|
|
||||||
|
[zrl=[baseurl]/help/hook/daemon_addon]daemon_addon[/zrl]
|
||||||
|
Called when invoking the extensible background daemon
|
||||||
|
|
||||||
[zrl=[baseurl]/help/hook/directory_item]directory_item[/zrl]
|
[zrl=[baseurl]/help/hook/directory_item]directory_item[/zrl]
|
||||||
Called when generating a directory listing for display
|
Called when generating a directory listing for display
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user