aboutsummaryrefslogtreecommitdiffstats
path: root/include/poller.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2013-08-24 17:05:18 +0100
committerThomas Willingham <founder@kakste.com>2013-08-24 17:05:18 +0100
commitc803fb90df3bbbd8bb88df09a271b5a9214e8c1d (patch)
tree0ad021580411798fc0ab025f1b1c302fe8afd3f6 /include/poller.php
parent6999fb586ba90e9f1c79e9f09f4035f63fb925fd (diff)
parentb0dd38b30949f907265eda757bfa14aa1f38b38f (diff)
downloadvolse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.tar.gz
volse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.tar.bz2
volse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/poller.php')
-rw-r--r--include/poller.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/include/poller.php b/include/poller.php
index 00914a712..7a6aaeb22 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -84,7 +84,8 @@ function poller_run($argv, $argc){
set_config('system','last_expire_day',$d2);
- proc_run('php','include/expire.php');
+// Uncomment when expire protocol component is working
+// proc_run('php','include/expire.php');
proc_run('php','include/cli_suggest.php');
@@ -117,18 +118,18 @@ function poller_run($argv, $argc){
$force = false;
$restart = false;
- if((argc() > 1) && (argv(1) == 'force'))
+ if(($argc > 1) && ($argv[1] == 'force'))
$force = true;
- if((argc() > 1) && (argv(1) == 'restart')) {
+ if(($argc > 1) && ($argv[1] == 'restart')) {
$restart = true;
- $generation = intval(argv(2));
+ $generation = intval($argv[2]);
if(! $generation)
killme();
}
- if((argc() > 1) && intval(argv(1))) {
- $manual_id = intval(argv(1));
+ if(($argc > 1) && intval($argv[1])) {
+ $manual_id = intval($argv[1]);
$force = true;
}
@@ -156,7 +157,8 @@ function poller_run($argv, $argc){
: ''
);
- $contacts = q("SELECT abook_id, abook_updated, abook_closeness, abook_channel
+
+ $contacts = q("SELECT abook_id, abook_updated, abook_connected, abook_closeness, abook_channel
FROM abook LEFT JOIN account on abook_account = account_id where 1
$sql_extra
AND (( abook_flags = %d ) OR ( abook_flags = %d ))
@@ -188,10 +190,10 @@ function poller_run($argv, $argc){
else {
// if we've never connected with them, start the mark for death countdown from now
- if($c === '0000-00-00 00:00:00') {
+ if($c == '0000-00-00 00:00:00') {
$r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1",
dbesc(datetime_convert()),
- intval($abook['abook_id'])
+ intval($contact['abook_id'])
);
$c = datetime_convert();
$update = true;
@@ -199,8 +201,8 @@ function poller_run($argv, $argc){
// He's dead, Jim
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 30 day")) {
- $r = q("update abook set abook_flags = (abook_flags & %d) where abook_id = %d limit 1",
+ if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) {
+ $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1",
intval(ABOOK_FLAG_ARCHIVED),
intval($contact['abook_id'])
);
@@ -212,17 +214,17 @@ function poller_run($argv, $argc){
// recently deceased, so keep up the regular schedule for 3 days
- if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 3 day"))
- && (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")))
+ if((strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 3 day")) > 0)
+ && (strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 1 day")) > 0))
$update = true;
// After that back off and put them on a morphine drip
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 2 day")) {
+ if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 2 day")) > 0) {
$update = true;
}
}
-
+dbg(0);
if((! $update) && (! $force))
continue;