aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Master.php
blob: 495718bf47291eca38b0bafc062f4806c8cdc574 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php

namespace Zotlabs\Daemon;

use Zotlabs\Lib\QueueWorker;

if (array_search(__file__, get_included_files()) === 0) {
	require_once('include/cli_startup.php');
	array_shift($argv);
	$argc = count($argv);

	if ($argc)
		Master::Release($argc, $argv);
	return;
}


class Master {

	static public function Summon($arr) {

		QueueWorker::Summon($arr);
		return;
/*
		$hookinfo = [
			'argv' => $arr
		];

		call_hooks('daemon_master_summon', $hookinfo);

		$arr  = $hookinfo['argv'];
		$argc = count($arr);

		if ((!is_array($arr) || ($argc < 1))) {
			logger("Summon handled by hook.", LOGGER_DEBUG);
			return;
		}

		$phpbin = get_config('system', 'phpbin', 'php');
		proc_run($phpbin, 'Zotlabs/Daemon/Master.php', $arr);
*/
	}

	static public function Release($argc, $argv) {
		cli_startup();

		QueueWorker::Release($argv);
		return;
/*
		$hookinfo = [
			'argv' => $argv
		];

		call_hooks('daemon_master_release', $hookinfo);

		$argv = $hookinfo['argv'];
		$argc = count($argv);

		if ((!is_array($argv) || ($argc < 1))) {
			logger("Release handled by hook.", LOGGER_DEBUG);
			return;
		}

		logger('Master: release: ' . json_encode($argv), LOGGER_ALL, LOG_DEBUG);
		$cls = '\\Zotlabs\\Daemon\\' . $argv[0];
		$cls::run($argc, $argv);
*/
	}
}