X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fpoller.php;h=89a3408ec90efcf04deca6aa7f5e1dd00afecee2;hb=4d5580ab7781eea81dc4cb3d67b7376f49357bef;hp=dbae1deec9713a80af16a19a2877b988a00fcfd4;hpb=2aef98f71d95ba5c2caae7637002daef0bce6de5;p=friendica.git diff --git a/include/poller.php b/include/poller.php index dbae1deec9..89a3408ec9 100644 --- a/include/poller.php +++ b/include/poller.php @@ -38,6 +38,18 @@ function poller_run($argv, $argc){ proc_run('php',"include/queue.php"); + // expire any expired accounts + + q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0 + AND `account_expires_on` != '0000-00-00 00:00:00' + AND `account_expires_on` < UTC_TIMESTAMP() "); + + $abandon_days = intval(get_config('system','account_abandon_days')); + if($abandon_days < 1) + $abandon_days = 0; + + + // once daily run expire in background $d1 = get_config('system','last_expire_day'); @@ -86,12 +98,17 @@ function poller_run($argv, $argc){ // and which have a polling address and ignore Diaspora since // we are unable to match those posts with a Diaspora GUID and prevent duplicates. + $abandon_sql = (($abandon_days) + ? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days)) + : '' + ); + $contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' AND `network` != '%s' $sql_extra AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 - AND `user`.`account_expired` = 0 ORDER BY RAND()", + AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DIASPORA) @@ -138,6 +155,8 @@ function poller_run($argv, $argc){ if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force) $hub_update = true; } + else + $hub_update = false; /** * Based on $contact['priority'], should we poll this site now? Or later? @@ -473,21 +492,25 @@ function poller_run($argv, $argc){ consume_feed($xml,$importer,$contact,$hub,1); + $hubmode = 'subscribe'; + if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) + $hubmode = 'unsubscribe'; - if((strlen($hub)) && ($hub_update) && (($contact['rel'] == CONTACT_IS_FRIEND) || (($contact['network'] === NETWORK_OSTATUS) && (! $contact['readonly'])))) { - logger('poller: subscribing to hub(s) : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']); + if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) { + logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']); $hubs = explode(',', $hub); if(count($hubs)) { foreach($hubs as $h) { $h = trim($h); if(! strlen($h)) continue; - subscribe_to_hub($h,$importer,$contact); + subscribe_to_hub($h,$importer,$contact,$hubmode); } } } } + $updated = datetime_convert(); $r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1",