Commit 725c7432 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't pull stats from db when they're not needed


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent c3c79536
......@@ -188,6 +188,8 @@ function site_data_current() {
}
function site_statistics($full=false) {
$data = array();
if ($full) {
$data = site_data_current();
$lastyear = db_format_timestamp(time() - 60*60*12*365);
......@@ -204,17 +206,6 @@ function site_statistics($full=false) {
$data['weekly'][$r->type][$keys[$r->type]++] = array($keys[$r->type], $r->value);
}
}
}
else {
$data = array();
}
$data['name'] = get_config('sitename');
$data['release'] = get_config('release');
$data['version'] = get_config('version');
$data['installdate'] = format_date(strtotime(get_config('installation_time')), 'strftimedate');
$data['dbsize'] = db_total_size();
$data['diskusage'] = get_field('site_data', 'value', 'type', 'disk-usage');
if (is_postgres()) {
$weekago = "CURRENT_DATE - INTERVAL '1 week'";
......@@ -243,7 +234,14 @@ function site_statistics($full=false) {
FROM {view}
WHERE NOT owner IS NULL AND owner > 0
"));
}
$data['name'] = get_config('sitename');
$data['release'] = get_config('release');
$data['version'] = get_config('version');
$data['installdate'] = format_date(strtotime(get_config('installation_time')), 'strftimedate');
$data['dbsize'] = db_total_size();
$data['diskusage'] = get_field('site_data', 'value', 'type', 'disk-usage');
$data['cronrunning'] = !record_exists_select('cron', 'nextrun < CURRENT_DATE');
return($data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment