X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=e7cae773cad5a81fff7a36ab8cb586885a40ba08;hb=4487515d0c8dc295e5f8b7a137accfa741b5cf52;hp=d819b7f421d9b9d1e7c620a669c2317d606952f6;hpb=a29842e3019255efd3f91fc01df29f5837d54fa4;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index d819b7f421..e7cae773ca 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -18,7 +18,7 @@ function onepoll_run(&$argv, &$argc){ if(is_null($db)) { @include(".htconfig.php"); - require_once("dba.php"); + require_once("include/dba.php"); $db = new dba($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data); }; @@ -42,7 +42,7 @@ function onepoll_run(&$argv, &$argc){ load_hooks(); logger('onepoll: start'); - + $manual_id = 0; $generation = 0; $hub_update = false; @@ -56,7 +56,17 @@ function onepoll_run(&$argv, &$argc){ logger('onepoll: no contact'); return; } - + + // Test + $lockpath = get_config('system','lockpath'); + if ($lockpath != '') { + $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id.'.lck'); + if($pidfile->is_already_running()) { + logger("onepoll: Already running for contact ".$contact_id); + exit; + } + } + $d = datetime_convert(); @@ -66,7 +76,7 @@ function onepoll_run(&$argv, &$argc){ $contacts = q("SELECT `contact`.* FROM `contact` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' - AND NOT `network` IN ( '%s', '%s' ) + AND NOT `network` IN ( '%s', '%s', '%s' ) AND `contact`.`id` = %d AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `contact`.`archive` = 0 LIMIT 1", @@ -74,6 +84,7 @@ function onepoll_run(&$argv, &$argc){ intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_FACEBOOK), + dbesc(NETWORK_PUMPIO), intval($contact_id) ); @@ -252,6 +263,9 @@ function onepoll_run(&$argv, &$argc){ $stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0); + if($contact['network'] === NETWORK_OSTATUS && get_pconfig($importer_uid,'system','ostatus_autofriend')) + $stat_writeable = 1; + if($stat_writeable != $contact['writable']) { q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", intval($stat_writeable), @@ -328,13 +342,17 @@ function onepoll_run(&$argv, &$argc){ ); if(count($r)) { - logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'],LOGGER_DEBUG); - if($meta->deleted && ! $r[0]['deleted']) { - q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1", - dbesc(datetime_convert()), - intval($r[0]['id']) - ); - } + logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG); + + // Only delete when mails aren't automatically moved or deleted + if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3)) + if($meta->deleted && ! $r[0]['deleted']) { + q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1", + dbesc(datetime_convert()), + intval($r[0]['id']) + ); + } + switch ($mailconf[0]['action']) { case 0: logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG); @@ -423,6 +441,7 @@ function onepoll_run(&$argv, &$argc){ continue; } $datarray['body'] = escape_tags($r['body']); + $datarray['body'] = limit_body_size($datarray['body']); logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']); @@ -508,6 +527,9 @@ function onepoll_run(&$argv, &$argc){ elseif($contact['network'] === NETWORK_FACEBOOK) { // This is picked up by the Facebook plugin on a cron hook. // Ignored here. + } elseif($contact['network'] === NETWORK_PUMPIO) { + // This is picked up by the pump.io plugin on a cron hook. + // Ignored here. } if($xml) { @@ -526,17 +548,17 @@ function onepoll_run(&$argv, &$argc){ // do it twice. Ensures that children of parents which may be later in the stream aren't tossed - + consume_feed($xml,$importer,$contact,$hub,1,2); $hubmode = 'subscribe'; if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) $hubmode = 'unsubscribe'; - if($contact['network'] === NETWORK_OSTATUS && (! $contact['hub-verify'])) + if(($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify'])) $hub_update = true; - if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) { + if((strlen($hub)) && ($hub_update) && (($contact['rel'] != CONTACT_IS_FOLLOWER) || $contact['network'] == NETWORK_FEED) ) { logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']); $hubs = explode(',', $hub); if(count($hubs)) {