From 2e14fda7c16ebfa19f8b6d3d4e840f5be95ad7ab Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 5 Mar 2010 22:14:00 +1300 Subject: [PATCH] Provide some rudimentary statistics about the setup. --- htdocs/setup.php | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/htdocs/setup.php b/htdocs/setup.php index b9f458c1..66df7e32 100644 --- a/htdocs/setup.php +++ b/htdocs/setup.php @@ -36,7 +36,7 @@ function check_pdo_pgsql() { include("interactive-page.php"); include("page-header.php"); -include("AwlQuery.php"); +require_once("AwlQuery.php"); function check_schema_version() { global $c; @@ -59,6 +59,34 @@ function check_davical_version() { } +function build_site_statistics() { + $principals = translate('No. of Principals'); + $collections = translate('No. of Collections'); + $resources = translate('No. of Resources'); + $table = << +$principals$collections$resources +%s + +EOTABLE; + + if ( !check_pdo_pgsql() ) { + return sprintf( $table, ''.translate('Site Statistics require the database to be available!').''); + } + $sql = 'SELECT +(SELECT count(1) FROM principal) AS principals, +(SELECT count(1) FROM collection) AS collections, +(SELECT count(1) FROM caldav_data) AS resources'; + $qry = new AwlQuery($sql); + if ( $qry->Exec('setup',__LINE__,__FILE__) && $s = $qry->Fetch() ) { + $row = sprintf('%s%s%s', + $s->principals, $s->collections, $s->resources ); + return sprintf( $table, $row ); + } + return sprintf( $table, ''.translate('Site Statistics require the database to be available!').''); +} + + $dependencies = array( translate('Current DAViCal version '). $c->version_string => 'check_davical_version', translate('DAViCal DB Schema version '). implode('.',$c->want_dbversion) => 'check_schema_version', @@ -92,6 +120,9 @@ $heading_dependencies = translate('Dependencies'); $th_dependency = translate('Dependency'); $th_status = translate('Status'); +$heading_site_statistics = translate('Site Statistics'); +$site_statistics_table = build_site_statistics(); + $heading_config_clients = translate('Configuring Calendar Clients for DAViCal'); $heading_config_davical = translate('Configuring DAViCal'); @@ -103,13 +134,13 @@ tr.dep_ok { tr.dep_fail { background-color:#ffc0c0; } -table.dependencies { +table, table.dependencies { border: 1px grey solid; border-collapse: collapse; padding: 0.1em; - margin-left: 3px; + margin: 0 1em 1.5em; } -table.dependencies tr td, table.dependencies tr th { +table tr td, table tr th, table.dependencies tr td, table.dependencies tr th { border: 1px grey solid; padding: 0.1em 0.2em; } @@ -162,8 +193,11 @@ function toggle_visible() {

+

$heading_site_statistics

+

$site_statistics_table

+

$heading_config_clients

-

The DAViCal client setup page on sourceforge have information on how +

The DAViCal client setup page on sourceforge has information on how to configure Evolution, Sunbird, Lightning and Mulberry to use remotely hosted calendars.

The administrative interface has no facility for viewing or modifying calendar data.