From 2e6dca26f20a09594db60411ed6854b4bc16cf9e Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 20 Feb 2010 13:44:40 +1300 Subject: [PATCH] More localisable, and now able to detect the PDO pgsql drivers. Also don't require a person to be logged in if their setup is so screwed they can't even connect to a database... --- htdocs/setup.php | 105 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 30 deletions(-) diff --git a/htdocs/setup.php b/htdocs/setup.php index 8833594f..0a7aeb78 100644 --- a/htdocs/setup.php +++ b/htdocs/setup.php @@ -2,32 +2,41 @@ include("../inc/always.php"); include("DAViCalSession.php"); -$session->LoginRequired(); -include("interactive-page.php"); -include("page-header.php"); +ob_start( ); +phpinfo(); +$phpinfo = ob_get_contents( ); +ob_end_clean( ); -include("AwlQuery.php"); +$phpinfo = preg_replace( '{^.*?}s', '', $phpinfo); +$phpinfo = preg_replace( '{.*?$}s', '', $phpinfo); + +$loaded_extensions = array_flip(get_loaded_extensions()); /** @TODO: work out something more than true/false returns for dependency checks */ +function check_pgsql() { + return function_exists('pg_connect'); +} + +if ( check_pgsql() ) { + $session->LoginRequired(); +} + function check_pdo() { return class_exists('PDO'); } function check_pdo_pgsql() { - global $_awl_dbconn; + global $phpinfo, $loaded_extensions; + if ( !class_exists('PDO') ) return false; - - if ( !isset($_awl_dbconn) || $_awl_dbconn === false ) _awl_connect_configured_database(); - if ( $_awl_dbconn === false ) return false; -/* $version = $_awl_dbconn->GetVersion(); - if ( !isset($version) ) return false;*/ - return true; + return isset($loaded_extensions['pdo_pgsql']); } -function check_pgsql() { - return function_exists('pg_connect'); -} +include("interactive-page.php"); +include("page-header.php"); + +include("AwlQuery.php"); function check_schema_version() { global $c; @@ -51,11 +60,11 @@ function check_davical_version() { $dependencies = array( - 'Current DAViCal version '. $c->version_string => 'check_davical_version', - 'DAViCal DB Schema version '. implode('.',$c->want_dbversion) => 'check_schema_version', - 'PHP PDO module available' => 'check_pdo', - 'PDO PostgreSQL divers' => 'check_pdo_pgsql', - 'PHP PostgreSQL available' => 'check_pgsql' /*, + translate('Current DAViCal version '). $c->version_string => 'check_davical_version', + translate('DAViCal DB Schema version '). implode('.',$c->want_dbversion) => 'check_schema_version', + translate('PHP PDO module available') => 'check_pdo', + translate('PDO PostgreSQL divers') => 'check_pdo_pgsql', + translate('PHP PostgreSQL available') => 'check_pgsql' /*, 'YAML' => 'php5-syck' */ ); @@ -72,6 +81,20 @@ foreach( $dependencies AS $k => $v ) { $want_dbversion = implode('.',$c->want_dbversion); +$heading_setup = translate('Setup'); +$paragraph_setup = translate('Currently this page does very little. Suggestions or patches to make it do more useful stuff will be gratefully received.'); + +$heading_versions = translate('Current Versions'); +$paragraph_versions = translate('You are currently running DAViCal version %s. The database schema should be at version %s and it is at version %s.'); +$paragraph_versions = sprintf( $paragraph_versions, $c->version_string, $want_dbversion, $c->schema_major.$c->schema_minor.$c->schema_patch); + +$heading_dependencies = translate('Dependencies'); +$th_dependency = translate('Dependency'); +$th_status = translate('Status'); + +$heading_config_clients = translate('Configuring Calendar Clients for DAViCal'); +$heading_config_davical = translate('Configuring DAViCal'); + echo << tr.dep_ok { @@ -95,34 +118,56 @@ p { } -

Setup

-

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

$heading_setup

+

$paragraph_setup -

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. +

$heading_versions

+

$paragraph_versions
 

-

Dependencies

+

$heading_dependencies

- - + + $dependencies_table
DependencyStatus$th_dependency$th_status

 

-

Configuring Calendar Clients for DAViCal

+

+ + +

$heading_config_clients

The DAViCal client setup page on sourceforge have 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.

-

Configuring DAViCal

+

$heading_config_davical

If you can read this then things must be mostly working already.

The DAViCal installation page on sourceforge has some further information on how to install and configure this application.