Пример #1
0
            $feedurl .= '?f=&mindate=' . urlencode($last_update);
            $x = z_fetch_url($feedurl);
            logger('feed_update: ' . print_r($x, true), LOGGER_DATA);
        }
        if ($x && $x['success']) {
            $total = 0;
            logger('onepoll: feed update ' . $contact['xchan_name'] . ' ' . $feedurl);
            $j = json_decode($x['body'], true);
            if ($j['success'] && $j['messages']) {
                foreach ($j['messages'] as $message) {
                    $results = process_delivery(array('hash' => $contact['xchan_hash']), get_item_elements($message), array(array('hash' => $importer['xchan_hash'])), false);
                    logger('onepoll: feed_update: process_delivery: ' . print_r($results, true), LOGGER_DATA);
                    $total++;
                }
                logger("onepoll: {$total} messages processed");
            }
        }
    }
    // update the poco details for this connection
    if ($contact['xchan_connurl']) {
        $r = q("SELECT xlink_id from xlink \n\t\t\twhere xlink_xchan = '%s' and xlink_updated > %s - INTERVAL %s and xlink_static = 0 limit 1", intval($contact['xchan_hash']), db_utcnow(), db_quoteinterval('1 DAY'));
        if (!$r) {
            poco_load($contact['xchan_hash'], $contact['xchan_connurl']);
        }
    }
    return;
}
if (array_search(__FILE__, get_included_files()) === 0) {
    onepoll_run($argv, $argc);
    killme();
}
Пример #2
0
        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 : '******'name']);
            $hubs = explode(',', $hub);
            if (count($hubs)) {
                foreach ($hubs as $h) {
                    $h = trim($h);
                    if (!strlen($h)) {
                        continue;
                    }
                    subscribe_to_hub($h, $importer, $contact, $hubmode);
                }
            }
        }
    }
    $updated = datetime_convert();
    $r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d", dbesc($updated), dbesc($updated), intval($contact['id']));
    // load current friends if possible.
    if ($contact['poco']) {
        $r = q("SELECT count(*) as total from glink\n\t\t\twhere `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", intval($contact['id']));
    }
    if (count($r)) {
        if (!$r[0]['total']) {
            poco_load($contact['id'], $importer_uid, 0, $contact['poco']);
        }
    }
    return;
}
if (array_search(__FILE__, get_included_files()) === 0) {
    onepoll_run($_SERVER["argv"], $_SERVER["argc"]);
    killme();
}