diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-09-26 11:42:48 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-09-26 11:42:48 +0200 |
commit | 5792b3d3580b9f09460305858293398d8d8a9abf (patch) | |
tree | 90d60e9db4ed733a60c2890c7305d45ddd48be42 /addon/poormancron/poormancron.php | |
parent | 991656a3ef396d9a6bd43ddb752627c2880b17ba (diff) | |
parent | 428e6766411d2c6708ad25f726c4bcf1d64af1cc (diff) | |
download | volse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.tar.gz volse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.tar.bz2 volse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.zip |
Merge branch 'master' into newui
Diffstat (limited to 'addon/poormancron/poormancron.php')
-rw-r--r-- | addon/poormancron/poormancron.php | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/addon/poormancron/poormancron.php b/addon/poormancron/poormancron.php deleted file mode 100644 index bbe023cd7..000000000 --- a/addon/poormancron/poormancron.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Name: Poor Man Cron - * Description: Execute updates on pageviews, without the need of commandline php - * Version: 1.2 - * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix> - */ - -function poormancron_install() { - // 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") { - set_config('poormancron','usecli',1); - logger("poormancron will use cli php"); - } else { - set_config('poormancron','usecli',0); - logger("poormancron will NOT use cli php"); - } - - 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('page_end', '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); - proc_run('php',"include/poller.php"); - } -} - -function poormancron_procrun(&$a, &$arr) { - if (get_config('poormancron','usecli')==1) return; - $argv = $arr['args']; - $arr['run_cmd'] = false; - logger("poormancron procrun ".implode(", ",$argv)); - array_shift($argv); - $argc = count($argv); - logger("poormancron procrun require_once ".basename($argv[0])); - require_once(basename($argv[0])); - $funcname=str_replace(".php", "", basename($argv[0]))."_run"; - - $funcname($argv, $argc); -} - - -?> |