updated poormancron plugin

This commit is contained in:
Fabio Comuni 2011-01-28 14:04:40 +01:00
parent ef33ca6750
commit 302acda089

View file

@ -7,18 +7,15 @@
*/ */
function poormancron_install() { function poormancron_install() {
register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
register_hook('profile_sidebar', 'addon/poormancron/poormancron.php', 'poormancron_hook'); register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
logger("installed poormancron"); logger("installed poormancron");
} }
function poormancron_uninstall() { function poormancron_uninstall() {
unregister_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
unregister_hook('profile_sidebar', 'addon/poormancron/poormancron.php', 'poormancron_hook'); unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun'); logger("removed poormancron");
logger("removed poormancron");
} }
@ -30,22 +27,22 @@ function poormancron_hook($a,&$b) {
// 300 secs, 5 mins // 300 secs, 5 mins
if (!$lastupdate || ($now-$lastupdate)>300) { if (!$lastupdate || ($now-$lastupdate)>300) {
set_config('poormancron','lastupdate', $now); set_config('poormancron','lastupdate', $now);
$b .= "<img src='".$a->get_baseurl()."/queue_wrapper.php' width='1px' height='1px' style='display:none'>"; $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$b .= "<img src='".$a->get_baseurl()."/poller_wrapper.php' width='1px' height='1px' style='display:none'>"; proc_run($php_path,"include/poller.php");
} }
} }
function poormancron_procrun($a, $argv) {
function poormancron_procrun($a, $args) { logger("poormancron procrun ".implode(", ",$argv));
$argv = array_shift($args); array_shift($argv);
$argc = count($argv); $argc = count($argv);
function killme(){ logger("poormancron procrun require_once ".basename($argv[0]));
// pass require_once(basename($argv[0]));
} $funcname=str_replace(".php", "", basename($argv[0]))."_run";
require_once($argv[0]);
$funcname($argv, $argc);
} }
?> ?>