From 5912c504c48027d8a6733f1420ad822cfce9014f Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Mon, 7 May 2012 17:01:38 +0000
Subject: [PATCH] check db parameters

---
 core/trunk/install/class/class_install.php | 24 ++++++++++++++++++++++
 core/trunk/install/test.php                | 23 +++++++++++++++------
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/core/trunk/install/class/class_install.php b/core/trunk/install/class/class_install.php
index da159732210..9bf8b8cb4de 100644
--- a/core/trunk/install/class/class_install.php
+++ b/core/trunk/install/class/class_install.php
@@ -299,4 +299,28 @@ class install extends functions
             $db->query($query);
         }
     }
+    
+    /**
+     * create the docservers
+     * @param $docserverPath string path to the docserver
+     * @return boolean
+     */
+    public function checkDatabaseParameters(
+        $databaseserver,
+        $databaseserverport,
+        $databaseuser,
+        $databasepassword,
+        $databasename,
+        $databasetype
+    )
+    {
+        $_SESSION['config']['databaseserver'] =  $databaseserver;
+        $_SESSION['config']['databaseserverport'] = $databaseserverport;
+        $_SESSION['config']['databaseuser'] = $databaseuser;
+        $_SESSION['config']['databasepassword'] = $databasepassword;
+        $_SESSION['config']['databasename'] = $databasename;
+        $_SESSION['config']['databasetype'] = $databasetype;
+        $db = new dbquery();
+        $db->connect();
+    }
 }
diff --git a/core/trunk/install/test.php b/core/trunk/install/test.php
index f47b9224e24..5f689c8f731 100644
--- a/core/trunk/install/test.php
+++ b/core/trunk/install/test.php
@@ -5,12 +5,12 @@ include_once '../core/init.php';
 require_once 'install/class/class_install.php';
 
 //databasevars 
-$_SESSION['config']['databaseserver'] = '127.0.0.1';
-$_SESSION['config']['databaseserverport'] = '5432';
-$_SESSION['config']['databaseuser'] = 'postgres';
-$_SESSION['config']['databasepassword'] = 'maarch';
-$_SESSION['config']['databasename'] = 'maarch_entreprise';
-$_SESSION['config']['databasetype'] = 'POSTGRESQL';
+$databaseserver = '127.0.0.1';
+$databaseserverport = '5432';
+$databaseuser = 'postgres';
+$databasepassword = 'maarch';
+$databasename = 'maarch_entreprise';
+$databasetype = 'POSTGRESQL';
 
 $install = new install();
 $languages = $install->getlanguages();
@@ -45,6 +45,17 @@ echo 'short_open_tag:' . $install->isIniShortOpenTagRequirements();
 echo '<br>';
 echo 'magic_quotes_gpc:' . $install->isIniMagicQuotesGpcRequirements();
 echo '<br>';
+echo '<h1>DATABASE</h1>';
+echo 'check database parameters:' 
+. $install->checkDatabaseParameters(
+    $databaseserver,
+    $databaseserverport,
+    $databaseuser,
+    $databasepassword,
+    $databasename,
+    $databasetype
+);
+echo '<br>';
 echo '<h1>DOCSERVERS</h1>';
 echo 'docserver root:' . $install->checkDocserverRoot('c:\maarch\docservers\tests');
 echo '<br>';
-- 
GitLab