Statistics
body<=
Statistics h1?>
here.
p?>
prepare("SELECT statcat, statkey, statval FROM stats WHERE statcat IN ('userinfo', 'client', 'age', 'gender', 'account', 'size')");
$sth->execute;
while ($_ = $sth->fetchrow_hashref) {
$stat{$_->{'statcat'}}->{$_->{'statkey'}} = $_->{'statval'};
}
unless (%stat) {
return "ljmaint.pl genstats, or ideally, put it in cron to run nightly. p?>";
}
$sth = $dbr->prepare("SELECT c.item, s.statval FROM stats s, codes c WHERE c.type='country' AND s.statcat='country' AND s.statkey=c.code ORDER BY s.statval DESC LIMIT 15");
$sth->execute;
while ($_ = $sth->fetchrow_hashref) {
$stat{'country'}->{$_->{'item'}} = $_->{'statval'};
}
$sth = $dbr->prepare("SELECT c.item, s.statval FROM stats s, codes c WHERE c.type='state' AND s.statcat='stateus' AND s.statkey=c.code ORDER BY s.statval DESC LIMIT 15");
$sth->execute;
while ($_ = $sth->fetchrow_hashref) {
$stat{'state'}->{$_->{'item'}} = $_->{'statval'};
}
my $total = $stat{'userinfo'}->{'total'}+0;
my $usedever = $stat{'userinfo'}->{'updated'}+0;
my $used30 = $stat{'userinfo'}->{'updated_last30'}+0;
my $used7 = $stat{'userinfo'}->{'updated_last7'}+0;
my $usedlastday = $stat{'userinfo'}->{'updated_last1'}+0;
my $allow_getljnews = $stat{'userinfo'}->{'allow_getljnews'}+0;
my $active = $stat{'size'}->{'accounts_active'}+0;
my $ret = "";
$ret .= "\n";
$ret .= "
";
$ret .= "
Total accounts: $total
\n";
$ret .= "
... active in some way: $active
\n" if $active;
$ret .= "
... that have ever updated: $usedever
\n";
$ret .= "
... updating in last 30 days: $used30
\n";
$ret .= "
... updating in last 7 days: $used7
\n";
$ret .= "
... updating in past 24 hours: $usedlastday
\n";
$ret .= "
\n";
$ret .= "\n";
$ret .= "
";
{
my $male = $stat{'gender'}->{'M'}+0;
my $female = $stat{'gender'}->{'F'}+0;
my $tot = $male+$female;
$tot ||= 1;
$ret .= "
\n";
# }
# }
# return early, since the graphs below are pretty much broken now
# with index changes. FIXME: make alternate means to generate stats
$ret .= "";
$ret .= "