var_dump(count($messages)); echo "importing - "; var_dump($saveRes = $store->save($messages)); if ($saveRes['success'] == 0) { echo "failures, stopping\n"; break; } $timestamp = $messages[0]->timestamp; } while (true); } switch ($_SERVER['argv'][1]) { case 'list': $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"; } break; case 'pull': $by = @$_SERVER['argv'][2] ?: 'user_ids'; // 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':