[Vtigercrm-commits] [vtiger-commits] r5945 - in /vtigercrm/branches/5.0_postgresql_integration: install.php install/2setConfig.php install/3confirmConfig.php install/4createConfigFile.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sun May 14 01:30:58 EDT 2006


Author: jrydbeck
Date: Sat May 13 23:30:55 2006
New Revision: 5945

Log:
Increased handling for PostgreSQL during the installation.  MySQL was hard-coded for writing to the config file at generation.  Port handling is now automated to use 5432 if database is PostgreSQL.  Finally, if the user elects to change their configuration before committing, the selection of PostgreSQL is preserved.

Modified:
    vtigercrm/branches/5.0_postgresql_integration/install.php
    vtigercrm/branches/5.0_postgresql_integration/install/2setConfig.php
    vtigercrm/branches/5.0_postgresql_integration/install/3confirmConfig.php
    vtigercrm/branches/5.0_postgresql_integration/install/4createConfigFile.php

Modified: vtigercrm/branches/5.0_postgresql_integration/install.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/install.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/install.php Sat May 13 23:30:55 2006
@@ -16,6 +16,8 @@
  * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install.php,v 1.2 2004/10/06 09:02:02 jack Exp $
  * Description:  Starts the installation process.
  ********************************************************************************/
+
+include('adodb/adodb.inc.php');
 
 if (substr(phpversion(), 0, 1) == "5") {
 	ini_set("zend.ze1_compatibility_mode", "1");

Modified: vtigercrm/branches/5.0_postgresql_integration/install/2setConfig.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/install/2setConfig.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/install/2setConfig.php Sat May 13 23:30:55 2006
@@ -88,6 +88,11 @@
 	$db_password = $_REQUEST['db_password'];
 	elseif (isset($dbconfig['db_password']))
 	$db_password = $dbconfig['db_password'];
+
+	if (isset($_REQUEST['db_type']))
+	$db_type = $_REQUEST['db_type'];
+	elseif (isset($dbconfig['db_type']))
+	$db_type = $dbconfig['db_type'];
 
 	if (isset($_REQUEST['db_name']))
 	$db_name = $_REQUEST['db_name'];
@@ -306,12 +311,12 @@
 		<?php if(!$db_options) : ?>
 			No Database Support Deteched
 		<?php elseif(count($db_options) == 1) : ?>
-			<?php list($dbtype, $label) = each($db_options); ?>
-			<input type="hidden" name="dbtype" value="<?php echo $dbtype ?>"><?php echo $label ?>
+			<?php list($db_type, $label) = each($db_options); ?>
+			<input type="hidden" name="db_type" value="<?php echo $db_type ?>"><?php echo $label ?>
 		<?php else : ?>
-			<select name="dbtype">
-			<?php foreach($db_options as $dbtype => $label) : ?>
-				<option value="<?php echo $dbtype ?>"><?php echo $label ?></option>
+			<select name="db_type">
+			<?php foreach($db_options as $db_option_type => $label) : ?>
+				<option value="<?php echo $db_option_type ?>" <?php if(isset($db_type) && $db_type == $db_option_type) { echo "SELECTED"; } ?>><?php echo $label ?></option>
 			<?php endforeach ?>
 			</select>
 		<?php endif ?>

Modified: vtigercrm/branches/5.0_postgresql_integration/install/3confirmConfig.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/install/3confirmConfig.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/install/3confirmConfig.php Sat May 13 23:30:55 2006
@@ -33,7 +33,7 @@
 if (isset($_REQUEST['ftpserver'])) $ftpserver= $_REQUEST['ftpserver'];
 if (isset($_REQUEST['ftpuser'])) $ftpuser = $_REQUEST['ftpuser'];
 if (isset($_REQUEST['ftppassword'])) $ftppassword= $_REQUEST['ftppassword'];
-if (isset($_REQUEST['dbtype'])) $dbtype	= $_REQUEST['dbtype'];
+if (isset($_REQUEST['db_type'])) $db_type	= $_REQUEST['db_type'];
 
 // db_type_status - is there a db type?
 // db_exist_status - does the database exist?
@@ -41,19 +41,19 @@
 // db_created_status - did we create a database?
 
 //Checking for database connection parameters
-if($dbtype == '')
+if($db_type == '')
 {
 	$db_type_status = false;
 }
 else
 {
 	include('adodb/adodb.inc.php');
-	$conn = &NewADOConnection($dbtype);
+	$conn = &NewADOConnection($db_type);
 	$db_type_status = true;
 	if($conn->Connect($db_hostname,$db_username,$db_password))
 	{
 		$db_server_status = true;
-		if($dbtype=='mysql')
+		if($db_type=='mysql')
 		{
 			$version = explode('-',mysql_get_server_info($conn));
 			$mysql_server_version=$version[0];
@@ -65,7 +65,7 @@
 			$root_password = $_REQUEST['root_password'];
 
 			// drop the current database if it exists
-			$dropdb_conn = &NewADOConnection($dbtype);
+			$dropdb_conn = &NewADOConnection($db_type);
 			if($dropdb_conn->Connect($db_hostname, $root_user, $root_password, $db_name))
 			{
 				$query = "drop database ".$db_name;
@@ -74,7 +74,7 @@
 			}
 
 			// create the new database
-			$createdb_conn = &NewADOConnection($dbtype);
+			$createdb_conn = &NewADOConnection($db_type);
 			$createdb_conn->Connect($db_hostname, $root_user, $root_password);
 			$query = "create database ".$db_name;
 			$createdb_conn->Execute($query);
@@ -181,7 +181,7 @@
 	</tr>
 	<tr>
 	<td noWrap bgcolor="#F5F5F5" width="40%">Database Type</td>
-	<td bgcolor="White" align="left" nowrap><font class="dataInput"><?php if (isset($dbtype)) echo "$dbtype"; ?></font></td>
+	<td bgcolor="White" align="left" nowrap><font class="dataInput"><?php if (isset($db_type)) echo "$db_type"; ?></font></td>
 	</tr>
 	<tr>
 	<td noWrap bgcolor="#F5F5F5" width="40%">Database Name</td>
@@ -246,7 +246,7 @@
 	</html>
 <?php
 }
-elseif($dbtype == 'mysql' && ($mysql_server_version < '4.1' || $mysql_server_version > '5.0.19'))
+elseif($db_type == 'mysql' && ($mysql_server_version < '4.1' || $mysql_server_version > '5.0.19'))
 {
 ?>
 	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -405,7 +405,7 @@
 	<div style="background-color:#ff0000;color:#ffffff;padding:5px">
 	<b>Unable to Create Database <?php echo $db_name ?></b>
 	</div>
-	<P>Message: The MySQL User "<? echo $root_user ?>" doesn't have permission to Create database. Try changing the Database settings<P></font>
+	<P>Message: The database User "<? echo $root_user ?>" doesn't have permission to Create database. Try changing the Database settings<P></font>
 
 	<br><br>
 	<table border=0 width=100% cellspacing=0 cellpadding=0>
@@ -637,7 +637,7 @@
 	</tr>
 	<tr bgcolor="White">
 	<td noWrap bgcolor="#F5F5F5" width="40%">Database Type</td>
-	<td align="left" nowrap> <font class="dataInput"><?php if (isset($dbtype)) echo "$dbtype"; ?></font></td>
+	<td align="left" nowrap> <font class="dataInput"><?php if (isset($db_type)) echo "$db_type"; ?></font></td>
 	</tr>
 	<tr bgcolor="White">
 	<td noWrap bgcolor="#F5F5F5" width="40%">Database Name</td>

Modified: vtigercrm/branches/5.0_postgresql_integration/install/4createConfigFile.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/install/4createConfigFile.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/install/4createConfigFile.php Sat May 13 23:30:55 2006
@@ -52,16 +52,13 @@
 
 if (isset($_REQUEST['db_hostname'])) 	list($db_hostname,$db_port) = 	split(":",$_REQUEST['db_hostname']);
 
-// update default mysql port if not 
-// provided, to be removed latter
-if ($db_port == "")
-$db_port = "3306";
-
 if (isset($_REQUEST['db_username'])) 	$db_username = 	$_REQUEST['db_username'];
 
 if (isset($_REQUEST['db_password'])) 	$db_password = 		$_REQUEST['db_password'];
 
 if (isset($_REQUEST['db_name'])) 		$db_name  	= 		$_REQUEST['db_name'];
+
+if (isset($_REQUEST['db_type'])) 		$db_type  	= 		$_REQUEST['db_type'];
 
 if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables = 	$_REQUEST['db_drop_tables'];
 
@@ -87,8 +84,24 @@
 
 if (isset($_REQUEST['ftppassword'])) $ftppassword = 	$_REQUEST['ftppassword'];
 
+// update default port
+if ($db_port == '')
+{
+	if($db_type == 'mysql')
+	{
+		$db_port = "3306";
+	}
+	elseif($db_type = 'pgsql')
+	{
+		$db_port = "5432";
+	}
+	elseif($db_type = 'oci8')
+	{
+		$db_port = '1521';
+	}
+}
+
 $cache_dir = 'cache/';
-
 
 
 ?>
@@ -172,7 +185,7 @@
 				      $buffer = str_replace( "_DBC_USER_", $db_username, $buffer);
 				      $buffer = str_replace( "_DBC_PASS_", $db_password, $buffer);
 				      $buffer = str_replace( "_DBC_NAME_", $db_name, $buffer);
-				      $buffer = str_replace( "_DBC_TYPE_", "mysql", $buffer);
+				      $buffer = str_replace( "_DBC_TYPE_", $db_type, $buffer);
 
 				      $buffer = str_replace( "_SITE_URL_", $site_URL, $buffer);
 





More information about the vtigercrm-commits mailing list