backup tgids master
[scannr.git] / purgeArchived.php
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
include('common.inc.php');
// delete archived calls
$sth = $conn->prepare("select tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename order by call_timestamp), ',') filenames from recordings group by tgid, ahour, aday order by  aday DESC, ahour, tgid;");
// TODO use tgid categories instead, tgid too specific
$sth->execute();
$hourlies = $sth->fetchAll(PDO::FETCH_ASSOC);
foreach($hourlies as $hourly) {
    processHourly($hourly);
}
 
// delete uninteresting compilations