issues marking for death

This commit is contained in:
friendica 2013-08-15 17:36:00 -07:00
parent ef414ba94c
commit d46436dc9c

View File

@ -118,18 +118,18 @@ function poller_run($argv, $argc){
$force = false; $force = false;
$restart = false; $restart = false;
if((argc() > 1) && (argv(1) == 'force')) if(($argc > 1) && ($argv[1] == 'force'))
$force = true; $force = true;
if((argc() > 1) && (argv(1) == 'restart')) { if(($argc > 1) && ($argv[1] == 'restart')) {
$restart = true; $restart = true;
$generation = intval(argv(2)); $generation = intval($argv[2]);
if(! $generation) if(! $generation)
killme(); killme();
} }
if((argc() > 1) && intval(argv(1))) { if(($argc > 1) && intval($argv[1])) {
$manual_id = intval(argv(1)); $manual_id = intval($argv[1]);
$force = true; $force = true;
} }
@ -157,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 FROM abook LEFT JOIN account on abook_account = account_id where 1
$sql_extra $sql_extra
AND (( abook_flags = %d ) OR ( abook_flags = %d )) AND (( abook_flags = %d ) OR ( abook_flags = %d ))
@ -189,10 +190,10 @@ function poller_run($argv, $argc){
else { else {
// if we've never connected with them, start the mark for death countdown from now // 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", $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1",
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($abook['abook_id']) intval($contact['abook_id'])
); );
$c = datetime_convert(); $c = datetime_convert();
$update = true; $update = true;
@ -200,8 +201,8 @@ function poller_run($argv, $argc){
// He's dead, Jim // He's dead, Jim
if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 30 day")) { 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", $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1",
intval(ABOOK_FLAG_ARCHIVED), intval(ABOOK_FLAG_ARCHIVED),
intval($contact['abook_id']) intval($contact['abook_id'])
); );
@ -213,17 +214,17 @@ function poller_run($argv, $argc){
// recently deceased, so keep up the regular schedule for 3 days // recently deceased, so keep up the regular schedule for 3 days
if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 3 day")) if((strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 3 day")) > 0)
&& (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))) && (strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 1 day")) > 0))
$update = true; $update = true;
// After that back off and put them on a morphine drip // 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; $update = true;
} }
} }
dbg(0);
if((! $update) && (! $force)) if((! $update) && (! $force))
continue; continue;