1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00
vichan/tools/stats.php

30 lines
786 B
PHP
Raw Permalink Normal View History

2014-01-31 23:39:04 +01:00
#!/usr/bin/php
2014-01-31 23:38:29 +01:00
<?php
require dirname(__FILE__) . '/inc/cli.php';
$variants = array(array("hour", 3600), array("day", 3600*24), array("3 days", 3600*24*3),
array("week", 3600*24*7), array("month", 3600*24*7*30));
2014-01-31 23:38:29 +01:00
printf(" || ");
foreach ($variants as $iter) {
list($term, $time) = $iter;
2014-01-31 23:38:29 +01:00
printf("%8s | ", $term);
}
print("\n");
print(str_repeat('=', 13+11*count($variants)));
print("\n");
$q = query("SELECT uri FROM ``boards``");
while ($f = $q->fetch()) {
printf("%10s || ", $f['uri']);
foreach ($variants as $iter) {
list($term, $time) = $iter;
2014-01-31 23:39:50 +01:00
$qq = query(sprintf("SELECT COUNT(*) as count FROM ``posts_%s`` WHERE time > %d", $f['uri'], time()-$time));
2014-01-31 23:38:29 +01:00
$c = $qq->fetch()['count'];
printf("%8d | ", $c);
}
print("\n");
}