From 1dbc3b185b7f2c59be660008f75e2e2523698433 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 31 Jan 2010 16:35:08 +1300 Subject: [PATCH] Move version display to setup.php and do basic dependency checks. --- htdocs/setup.php | 81 +++++++++++++++++++++++++++++++++++++++++++++- htdocs/upgrade.php | 7 ---- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/htdocs/setup.php b/htdocs/setup.php index 77cb752a..a66735b7 100644 --- a/htdocs/setup.php +++ b/htdocs/setup.php @@ -7,11 +7,90 @@ $session->LoginRequired(); include("interactive-page.php"); include("page-header.php"); +/** @TODO: work out something more than true/false returns for dependency checks */ +function check_pdo() { + return class_exists('PDO'); +} + +function check_pgsql() { + return function_exists('pg_connect'); +} + +function check_schema_version() { + global $c; + if ( $c->want_dbversion[0] == $c->schema_major + && $c->want_dbversion[1] == $c->schema_minor + && $c->want_dbversion[2] == $c->schema_patch ) { + return true; + } + return false; +} + +$dependencies = array( + 'DAViCal DB Schema version '. implode('.',$c->want_dbversion) => 'check_schema_version', + 'PHP PDO module available' => 'check_pdo', + 'PHP PostgreSQL available' => 'check_pgsql' /*, + 'YAML' => 'php5-syck' */ +); + +$dependencies_table = ''; +$dep_tpl = ' + %s + %s + +'; +foreach( $dependencies AS $k => $v ) { + $ok = $v(); + $dependencies_table .= sprintf( $dep_tpl, ($ok ? 'dep_ok' : 'dep_fail'), $k, ($ok ? 'OK' : 'Failed') ); +} + +$want_dbversion = implode('.',$c->want_dbversion); + echo << +tr.dep_ok { + background-color:#80ff80; +} +tr.dep_fail { + background-color:#ffc0c0; +} +table.dependencies { + border: 1px grey solid; + border-collapse: collapse; + padding: 0.1em; + margin-left: 3px; +} +table.dependencies tr td, table.dependencies tr th { + border: 1px grey solid; + padding: 0.1em 0.2em; +} +p { + padding: 0.3em 0.2em 0.7em; +} + +

Setup

-

Currently this page does nothing. Suggestions or patches to make it do something +

Currently this page does very little. Suggestions or patches to make it do something useful will be gratefully received. +

Current Versions

+

You are currently running DAViCal version $c->version_string. +The database schema should be at version $want_dbversion and it is at version $c->schema_major.$c->schema_minor.$c->schema_patch. +
  +

+ +

Dependencies

+

+ + + + + +$dependencies_table +
DependencyStatus
+
  +

+

Configuring Calendar Clients for DAViCal

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

diff --git a/htdocs/upgrade.php b/htdocs/upgrade.php index 1801b08a..c57375a7 100644 --- a/htdocs/upgrade.php +++ b/htdocs/upgrade.php @@ -14,19 +14,12 @@ $session->LoginRequired(); include("interactive-page.php"); include("page-header.php"); -$want_dbversion = implode('.',$c->want_dbversion); - echo <<Upgrade

Currently this page does nothing. Suggestions or patches to make it do something useful will be gratefully received.
 

-

Current Versions

-You are currently running DAViCal version $c->version_string. -The database schema should be at version $want_dbversion and it is at version $c->schema_major.$c->schema_minor.$c->schema_patch. -
  -

Upgrading DAViCal Versions

The update-davical-database should be run manually after upgrading the software to a new version of DAViCal.