Commit e26f8d05 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Display site installation date


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 56d51140
......@@ -147,6 +147,7 @@ $string['reopensitedetail'] = 'Your site is closed. Site administrators may sta
// Statistics
$string['sitestatistics'] = 'Site Statistics';
$string['siteinstalled'] = 'Site Installed';
$string['databasesize'] = 'Database Size';
$string['diskusage'] = 'Disk Usage';
$string['maharaversion'] = 'Mahara version';
......
......@@ -1323,9 +1323,7 @@ function xmldb_core_upgrade($oldversion=0) {
// @TODO: Stats upgrade:
// Daily data: count of logged-in users
// Add ctime to usr table for count of users created
// Add site start time to config table; initialise with earliest ctime from view, artefact, site_content?
// Add visits column to view table, updated daily from log on filesystem
// Records in cron table
if ($oldversion < 2009122200) {
// Table for collection of historical stats
......@@ -1354,6 +1352,9 @@ function xmldb_core_upgrade($oldversion=0) {
$cron->month = '*';
$cron->dayofweek = '*';
insert_record('cron', $cron);
// Put best guess at installation time into config table.
set_config('installation_time', get_field_sql("SELECT MIN(ctime) FROM {site_content}"));
}
return $status;
......
......@@ -205,12 +205,14 @@ function site_statistics() {
$data['weekly'][$r->type][$keys[$r->type]++] = array($keys[$r->type], $r->value);
}
}
$data['release'] = get_config('release');
$data['version'] = get_config('version');
$data['dbsize'] = db_total_size();
$data['diskusage'] = get_field('site_data', 'value', 'type', 'disk-usage');
return($data);
$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');
return($data);
}
?>
\ No newline at end of file
......@@ -560,6 +560,7 @@ function core_postinst() {
set_config('lang', 'en.utf8');
set_config('installation_key', get_random_key());
set_config('installation_time', $now);
// PostgreSQL supports indexes over functions of columns, MySQL does not.
// We make use if this if we can
......
......@@ -9,6 +9,7 @@ addLoadEvent(function () {literal}{{/literal}
{/if}
<div class="fl">
<h3>{$sitedata.name}: {str tag=sitestatistics section=admin}</h3>
<p><strong>{str tag=siteinstalled section=admin}:</strong> {$sitedata.installdate}</p>
<p><strong>{str tag=users}:</strong> {$sitedata.users}{if $sitedata.rank.users} ({str tag=Rank section=admin}: $sitedata.rank.users}){/if}</p>
<p><strong>{str tag=groups}:</strong> {$sitedata.groups}{if $sitedata.rank.groups} ({str tag=Rank section=admin}: $sitedata.rank.groups}){/if}</p>
<p><strong>{str tag=views}:</strong> {$sitedata.views}{if $sitedata.rank.views} ({str tag=Rank section=admin}: $sitedata.rank.views}){/if}</p>
......
Markdown is supported
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