Merge pull request #182 from annando/master
statistics: auto-registering the server.
This commit is contained in:
commit
4b63791fb1
1 changed files with 8 additions and 2 deletions
|
@ -42,8 +42,8 @@ function statistics_json_cron($a,$b) {
|
||||||
$last = get_config('statistics_json','last_calucation');
|
$last = get_config('statistics_json','last_calucation');
|
||||||
|
|
||||||
if($last) {
|
if($last) {
|
||||||
// Calculate all 3 hours
|
// Calculate all 6 hours
|
||||||
$next = $last + (180 * 60);
|
$next = $last + (360 * 60);
|
||||||
if($next > time()) {
|
if($next > time()) {
|
||||||
logger('statistics_json_cron: calculation intervall not reached');
|
logger('statistics_json_cron: calculation intervall not reached');
|
||||||
return;
|
return;
|
||||||
|
@ -102,6 +102,12 @@ function statistics_json_cron($a,$b) {
|
||||||
|
|
||||||
logger('statistics_json_cron: local_posts: '.$local_posts, LOGGER_DEBUG);
|
logger('statistics_json_cron: local_posts: '.$local_posts, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
// Now trying to register
|
||||||
|
$url = "http://pods.jasonrobinson.me/register/".$a->get_hostname();
|
||||||
|
logger('statistics_json_cron: registering url: '.$url, LOGGER_DEBUG);
|
||||||
|
$ret = fetch_url($url);
|
||||||
|
logger('statistics_json_cron: registering answer: '.$ret, LOGGER_DEBUG);
|
||||||
|
|
||||||
logger('statistics_json_cron: cron_end');
|
logger('statistics_json_cron: cron_end');
|
||||||
set_config('statistics_json','last_calucation', time());
|
set_config('statistics_json','last_calucation', time());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue