cleanup of daemon infrastructure

This commit is contained in:
redmatrix 2016-05-19 21:32:19 -07:00
parent 39bc0664a7
commit 014168a29b
2 changed files with 10 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class Master {
static public function Release($argc,$argv) { static public function Release($argc,$argv) {
cli_startup(); cli_startup();
logger('Master: release: ' . print_r($argv,true)); logger('Master: release: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG);
require_once('Zotlabs/Daemon/' . $argv[0] . '.php'); require_once('Zotlabs/Daemon/' . $argv[0] . '.php');
$cls = '\\Zotlabs\\Daemon\\' . $argv[0]; $cls = '\\Zotlabs\\Daemon\\' . $argv[0];
$cls::run($argc,$argv); $cls::run($argc,$argv);

View File

@ -1847,14 +1847,19 @@ function proc_run($cmd){
if(count($args) && $args[0] === 'php') if(count($args) && $args[0] === 'php')
$args[0] = ((x(App::$config,'system')) && (x(App::$config['system'],'php_path')) && (strlen(App::$config['system']['php_path'])) ? App::$config['system']['php_path'] : 'php'); $args[0] = ((x(App::$config,'system')) && (x(App::$config['system'],'php_path')) && (strlen(App::$config['system']['php_path'])) ? App::$config['system']['php_path'] : 'php');
// redirect proc_run statements of legacy daemon processes to the new Daemon Master object class
// We will keep this interface until everybody has transitioned.
if(strstr($args[1],'include/')) { if(strstr($args[1],'include/')) {
// convert 'include/foo.php' to 'Foo'
$orig = substr(ucfirst(substr($args[1],8)),0,-4); $orig = substr(ucfirst(substr($args[1],8)),0,-4);
logger('proc_run_redirect: ' . $orig); logger('proc_run_redirect: ' . $orig);
if(file_exists('Zotlabs/Daemon/' . $orig . '.php')) { if(file_exists('Zotlabs/Daemon/' . $orig . '.php')) {
array_shift($args); array_shift($args); // daemons are all run by php, pop it off the top of the array
$args[0] = $orig; $args[0] = $orig; // replace with the new daemon name
logger('Redirecting old proc_run interface: ' . print_r($args,true)); logger('Redirecting old proc_run interface: ' . print_r($args,true), LOGGER_DEBUG, LOG_DEBUG);
\Zotlabs\Daemon\Master::Summon($args); \Zotlabs\Daemon\Master::Summon($args); // summon the daemon
return; return;
} }
} }