From 3a575cdfdef10fdff6b96ef1bb71c19e441ff895 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 24 Jan 2011 22:02:53 +0100 Subject: first try of 'poormancron' whith 'proc_run' hook --- addon/poormancron/poormancron.php | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 addon/poormancron/poormancron.php (limited to 'addon/poormancron') diff --git a/addon/poormancron/poormancron.php b/addon/poormancron/poormancron.php new file mode 100644 index 000000000..98231727d --- /dev/null +++ b/addon/poormancron/poormancron.php @@ -0,0 +1,51 @@ +300) { + set_config('poormancron','lastupdate', $now); + $b .= ""; + $b .= ""; + + } + +} + + +function poormancron_procrun($a, $args) { + $argv = array_shift($args); + $argc = count($argv); + function killme(){ + // pass + } + require_once($argv[0]); +} + + +?> -- cgit v1.2.3 From 302acda0890a472916b759e6340ce77d9803f105 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 28 Jan 2011 14:04:40 +0100 Subject: updated poormancron plugin --- addon/poormancron/poormancron.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'addon/poormancron') diff --git a/addon/poormancron/poormancron.php b/addon/poormancron/poormancron.php index 98231727d..c31d2772c 100644 --- a/addon/poormancron/poormancron.php +++ b/addon/poormancron/poormancron.php @@ -7,18 +7,15 @@ */ function poormancron_install() { - - register_hook('profile_sidebar', 'addon/poormancron/poormancron.php', 'poormancron_hook'); - register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun'); - + register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook'); + register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun'); logger("installed poormancron"); } function poormancron_uninstall() { - - unregister_hook('profile_sidebar', 'addon/poormancron/poormancron.php', 'poormancron_hook'); - unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun'); - logger("removed poormancron"); + unregister_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook'); + unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun'); + logger("removed poormancron"); } @@ -30,22 +27,22 @@ function poormancron_hook($a,&$b) { // 300 secs, 5 mins if (!$lastupdate || ($now-$lastupdate)>300) { set_config('poormancron','lastupdate', $now); - $b .= ""; - $b .= ""; - + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + proc_run($php_path,"include/poller.php"); } - } - -function poormancron_procrun($a, $args) { - $argv = array_shift($args); +function poormancron_procrun($a, $argv) { + logger("poormancron procrun ".implode(", ",$argv)); + array_shift($argv); $argc = count($argv); - function killme(){ - // pass - } - require_once($argv[0]); + logger("poormancron procrun require_once ".basename($argv[0])); + require_once(basename($argv[0])); + $funcname=str_replace(".php", "", basename($argv[0]))."_run"; + + $funcname($argv, $argc); } + ?> -- cgit v1.2.3