<?php

use Fifa\ConnectId\Sdk\Storage\MessagesSqliteStorage;
use Fifa\ConnectId\Sdk\Storage\SqliteStorage;
use Psr\Log\NullLogger;

// install autoload from vendor
$dirname = str_replace('command', '', dirname(__FILE__));
require_once($dirname . '/vendor/autoload.php');

$logger = new NullLogger();

// remove older than one day
$timestamp = time() - (60 * 60 * 24);
$dateTime = new DateTime();
$dateTime->setTimestamp($timestamp);

// removal operation
$storage = SqliteStorage::getInstance($logger);
$storage->deleteOlderThan($dateTime);

$messagesStorage = MessagesSqliteStorage::getInstance($logger);
$messagesStorage->deleteOlderThan($dateTime);

