Example #1
0
        // thread_fbids
        $participant = @$_SERVER['argv'][3] ?: $config->participant;
        $timestamp = (@$_SERVER['argv'][4] ?: time()) * 1000;
        $offset = @$_SERVER['argv'][5] ?: 0;
        $limit = @$_SERVER['argv'][6] ?: 50000;
        $res = $service->getThreadRange($participant, $timestamp, $offset, $limit, $by);
        echo json_encode($res);
        break;
    case 'catchup':
        $by = @$_SERVER['argv'][2] ?: 'user_ids';
        // thread_fbids
        $participant = @$_SERVER['argv'][3] ?: $config->participant;
        catchupParticipant($config, $service, $store, $participant, $by);
        break;
    case 'catchupList':
        $offset = 0;
        $limit = 400;
        $filter = '';
        $res = $service->getThreadListRange($offset, $limit, $filter);
        foreach ($res->payload->threads as $thread) {
            echo str_pad($thread->thread_fbid, strlen('000000000000000'), ' ', STR_PAD_LEFT) . "\t" . str_pad($thread->message_count, 6, ' ', STR_PAD_LEFT) . "\t" . $thread->name . "\t" . $thread->snippet . "\n";
            catchupParticipant($config, $service, $store, $thread->thread_fbid, 'thread_fbids');
        }
        break;
    case 'import':
        $j = json_decode(file_get_contents($_SERVER['argv'][2]));
        $store = new MessageStore($config->messageStoreEndpoint);
        var_dump(count($j->payload->actions));
        print_r($store->save($j->payload->actions));
        break;
}
Example #2
0
            echo $channel->id . "\t" . $channel->name . "\t" . $channel->purpose->value . "\n";
        }
        break;
    case 'channelsHistory':
        $channel = @$_SERVER['argv'][2];
        $latest = @$_SERVER['argv'][3];
        $count = @$_SERVER['argv'][4] ?: 10000;
        $res = $service->channelsHistory($channel, $latest, $count);
        echo json_encode($res);
        break;
    case 'catchup':
        $by = @$_SERVER['argv'][2] ?: 'channel';
        $channels = @$_SERVER['argv'][3];
        if ($channels == 'all') {
            switch ($by) {
                case 'channel':
                    $channels = $service->channelsList()->channels;
                    break;
                case 'im':
                    $channels = $service->imList()->ims;
                    break;
            }
        } else {
            $channels = [(object) ['id' => $channels]];
        }
        foreach ($channels as $channel) {
            echo "catchup - " . @$channel->id . " - " . @$channel->name . "\n";
            catchupParticipant($config, $service, $store, $channel->id, $by);
        }
        break;
}