tools/stats.php: restore php 5.3 compatibility; fixes vichan-devel#85
This commit is contained in:
parent
a25e5f7839
commit
fd9196f036
@ -2,11 +2,12 @@
|
|||||||
<?php
|
<?php
|
||||||
require dirname(__FILE__) . '/inc/cli.php';
|
require dirname(__FILE__) . '/inc/cli.php';
|
||||||
|
|
||||||
$variants = [["hour", 3600], ["day", 3600*24], ["3 days", 3600*24*3],
|
$variants = array(array("hour", 3600), array("day", 3600*24), array("3 days", 3600*24*3),
|
||||||
["week", 3600*24*7], ["month", 3600*24*7*30]];
|
array("week", 3600*24*7), array("month", 3600*24*7*30));
|
||||||
|
|
||||||
printf(" || ");
|
printf(" || ");
|
||||||
foreach ($variants as list($term, $time)) {
|
foreach ($variants as $iter) {
|
||||||
|
list($term, $time) = $iter;
|
||||||
printf("%8s | ", $term);
|
printf("%8s | ", $term);
|
||||||
}
|
}
|
||||||
print("\n");
|
print("\n");
|
||||||
@ -17,7 +18,8 @@ print("\n");
|
|||||||
$q = query("SELECT uri FROM ``boards``");
|
$q = query("SELECT uri FROM ``boards``");
|
||||||
while ($f = $q->fetch()) {
|
while ($f = $q->fetch()) {
|
||||||
printf("%10s || ", $f['uri']);
|
printf("%10s || ", $f['uri']);
|
||||||
foreach ($variants as list($term, $time)) {
|
foreach ($variants as $iter) {
|
||||||
|
list($term, $time) = $iter;
|
||||||
$qq = query(sprintf("SELECT COUNT(*) as count FROM ``posts_%s`` WHERE time > %d", $f['uri'], time()-$time));
|
$qq = query(sprintf("SELECT COUNT(*) as count FROM ``posts_%s`` WHERE time > %d", $f['uri'], time()-$time));
|
||||||
$c = $qq->fetch()['count'];
|
$c = $qq->fetch()['count'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user