From: friendica Date: Sun, 6 Jan 2013 05:50:11 +0000 (-0800) Subject: add procrunner - 1/2 of poormancron X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=03fc4eb1168643aae372c17db73590a79de32c4f;p=friendica-addons.git add procrunner - 1/2 of poormancron --- diff --git a/extcron.tgz b/extcron.tgz index 0e5b2892..dabe1d09 100755 Binary files a/extcron.tgz and b/extcron.tgz differ diff --git a/extcron/extcron.php b/extcron/extcron.php index e3c21209..3eb34cdc 100755 --- a/extcron/extcron.php +++ b/extcron/extcron.php @@ -5,7 +5,7 @@ * Name: external cron * Description: Use external server or service to run poller regularly * Version: 1.0 - * Author: Mike Macgirvin + * Author: Mike Macgirvin * * Notes: External service needs to make a web request to http(s)://yoursite/extcron */ diff --git a/fbpost.tgz b/fbpost.tgz index ecf933d8..cb8f860a 100644 Binary files a/fbpost.tgz and b/fbpost.tgz differ diff --git a/procrunner.tgz b/procrunner.tgz new file mode 100644 index 00000000..fec9dfa7 Binary files /dev/null and b/procrunner.tgz differ diff --git a/procrunner/procrunner.php b/procrunner/procrunner.php new file mode 100755 index 00000000..4c6f64b6 --- /dev/null +++ b/procrunner/procrunner.php @@ -0,0 +1,53 @@ + + * Author: Mike Macgirvin + */ + +function procrunner_install() { + + $addons = get_config('system','addon'); + if(strstr('poormancron',$addons)) { + logger('procrunner incompatible with poormancron. Not installing procrunner.'); + return; + } + + // check for command line php + $a = get_app(); + $ex = Array(); + $ex[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + $ex[1] = dirname(dirname(dirname(__file__)))."/testargs.php"; + $ex[2] = "test"; + $out = exec(implode(" ", $ex)); + if ($out==="test") { + logger('procrunner not required on this system. Not installing.'); + return; + } else { + register_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun'); + logger("installed procrunner"); + } + +} + +function procrunner_uninstall() { + unregister_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun'); + logger("removed procrunner"); +} + + + +function procrunner_procrun(&$a, &$arr) { + + $argv = $arr['args']; + $arr['run_cmd'] = false; + logger("procrunner procrun ".implode(", ",$argv)); + array_shift($argv); + $argc = count($argv); + logger("procrunner procrun require_once ".basename($argv[0])); + require_once(basename($argv[0])); + $funcname=str_replace(".php", "", basename($argv[0]))."_run"; + $funcname($argv, $argc); +}