diff options
author | fabrixxm <fabrix.xm@gmail.com> | 2011-01-24 22:02:53 +0100 |
---|---|---|
committer | fabrixxm <fabrix.xm@gmail.com> | 2011-01-24 22:02:53 +0100 |
commit | 3a575cdfdef10fdff6b96ef1bb71c19e441ff895 (patch) | |
tree | 0592dec5bfb3e7607120680cc5258457d8e06035 | |
parent | 2020ea23b106c159a705c26e6c79156aafde75ba (diff) | |
download | volse-hubzilla-3a575cdfdef10fdff6b96ef1bb71c19e441ff895.tar.gz volse-hubzilla-3a575cdfdef10fdff6b96ef1bb71c19e441ff895.tar.bz2 volse-hubzilla-3a575cdfdef10fdff6b96ef1bb71c19e441ff895.zip |
first try of 'poormancron' whith 'proc_run' hook
-rw-r--r-- | addon/poormancron/poormancron.php | 51 |
1 files changed, 51 insertions, 0 deletions
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 @@ +<?php +/** + * Poor Man Cron. Execute updates on pageviews + * + * Addon Name: poormancron + * + */ + +function poormancron_install() { + + register_hook('profile_sidebar', '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"); +} + + + +function poormancron_hook($a,&$b) { + $now = time(); + $lastupdate = get_config('poormancron', 'lastupdate'); + + // 300 secs, 5 mins + if (!$lastupdate || ($now-$lastupdate)>300) { + set_config('poormancron','lastupdate', $now); + $b .= "<img src='".$a->get_baseurl()."/queue_wrapper.php' width='1px' height='1px' style='display:none'>"; + $b .= "<img src='".$a->get_baseurl()."/poller_wrapper.php' width='1px' height='1px' style='display:none'>"; + + } + +} + + +function poormancron_procrun($a, $args) { + $argv = array_shift($args); + $argc = count($argv); + function killme(){ + // pass + } + require_once($argv[0]); +} + + +?> |