4 * Description: Execute updates on pageviews, without the need of commandline php - only for use in total desperation as page loads will take forever
6 * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
10 function poormancron_install() {
11 // check for command line php
14 $ex[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
15 $ex[1] = dirname(dirname(dirname(__file__)))."/testargs.php";
17 $out = exec(implode(" ", $ex));
19 set_config('poormancron','usecli',1);
20 logger("poormancron will use cli php");
22 set_config('poormancron','usecli',0);
23 logger("poormancron will NOT use cli php");
26 register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
27 register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
28 logger("installed poormancron");
31 function poormancron_uninstall() {
32 unregister_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
33 unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
34 logger("removed poormancron");
39 function poormancron_hook(&$a,&$b) {
40 return; // deactivated
43 //$lastupdate = get_config('poormancron', 'lastupdate');
46 //if (!$lastupdate || ($now-$lastupdate)>300) {
47 // set_config('poormancron','lastupdate', $now);
48 // proc_run('php',"include/poller.php");
52 function poormancron_procrun(&$a, &$arr) {
53 return; // deactivated
55 if (get_config('poormancron','usecli')==1) return;
57 $arr['run_cmd'] = false;
58 logger("poormancron procrun ".implode(", ",$argv));
61 logger("poormancron procrun require_once ".basename($argv[0]));
62 require_once(basename($argv[0]));
63 $funcname=str_replace(".php", "", basename($argv[0]))."_run";
65 $funcname($argv, $argc);