[Fusionforge-commits] r9487 - in trunk/gforge: . common/forum common/include common/pm common/reporting common/search cronjobs plugins/webcalendar/www/includes www/frs/include www/pm/msproject www/reporting www/survey/admin

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Apr 14 21:31:21 CEST 2010


Author: lolando
Date: 2010-04-14 21:31:21 +0200 (Wed, 14 Apr 2010)
New Revision: 9487

Removed:
   trunk/gforge/common/include/database-mysql.php
   trunk/gforge/mkadmin-mysql.sh
Modified:
   trunk/gforge/common/forum/Forum.class.php
   trunk/gforge/common/forum/ForumFactory.class.php
   trunk/gforge/common/include/forms.php
   trunk/gforge/common/pm/ProjectTask.class.php
   trunk/gforge/common/reporting/ReportSetup.class.php
   trunk/gforge/common/reporting/report_utils.php
   trunk/gforge/common/search/ArtifactSearchQuery.class.php
   trunk/gforge/cronjobs/calculate_user_metric.php
   trunk/gforge/cronjobs/check_stale_tracker_items.php
   trunk/gforge/cronjobs/db_project_sums.php
   trunk/gforge/cronjobs/db_stats_agg.php
   trunk/gforge/cronjobs/project_weekly_metric.php
   trunk/gforge/cronjobs/site_stats.php
   trunk/gforge/cronjobs/vacuum.php
   trunk/gforge/plugins/webcalendar/www/includes/config.php
   trunk/gforge/www/frs/include/frs_utils.php
   trunk/gforge/www/pm/msproject/msp.php
   trunk/gforge/www/reporting/timeadd.php
   trunk/gforge/www/survey/admin/show_results_aggregate.php
Log:
Stop pretending we support MySQL

Modified: trunk/gforge/common/forum/Forum.class.php
===================================================================
--- trunk/gforge/common/forum/Forum.class.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/forum/Forum.class.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -213,22 +213,8 @@
 	function fetchData($group_forum_id) {
 		global $sys_database_type;
 
-		if ($sys_database_type == "mysql") {
-			$sql="
-				SELECT fgl.*,
-					(SELECT count(*) AS `count`
-						FROM (
-							SELECT DISTINCT group_forum_id, thread_id FROM forum
-						) AS tmp
-						WHERE tmp.group_forum_id = fgl.group_forum_id
-					) AS threads 
-				FROM forum_group_list_vw AS fgl
-				WHERE group_forum_id='$group_forum_id'";
-			$res = db_query_mysql ($sql);
-		} else {
-			$res = db_query_params ('SELECT * FROM forum_group_list_vw WHERE group_forum_id=$1',
-						array ($group_forum_id)) ;
-		}
+		$res = db_query_params ('SELECT * FROM forum_group_list_vw WHERE group_forum_id=$1',
+					array ($group_forum_id)) ;
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid forum group identifier'));
 			return false;

Modified: trunk/gforge/common/forum/ForumFactory.class.php
===================================================================
--- trunk/gforge/common/forum/ForumFactory.class.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/forum/ForumFactory.class.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -85,79 +85,26 @@
 		}
 
 		
-		if ($sys_database_type == "mysql") {
-			if (session_loggedin()) {
-				$perm =& $this->Group->getPermission( session_get_user() );
-				if (!$perm || !is_object($perm) || !$perm->isMember()) {
-					$public_flag='=1';
-					$exists = '';
-				} else {
-					$public_flag='<3';
-					if ($perm->isForumAdmin()) {
-						$exists='';
-					} else {
-						$exists=" AND group_forum_id IN (SELECT role_setting.ref_id
-					FROM role_setting, user_group
-					WHERE role_setting.value::integer >= 0
-                                          AND role_setting.section_name = 'forum'
-                                          AND role_setting.ref_id=forum_group_list_vw.group_forum_id
-                                          
-   					  AND user_group.role_id = role_setting.role_id
-					  AND user_group.user_id='".user_getid()."') ";
-					}
-				}
+		if (session_loggedin()) {
+			$perm =& $this->Group->getPermission( session_get_user() );
+			if (!$perm || !is_object($perm) || !$perm->isMember()) {
+				$result = db_query_params ('SELECT * FROM forum_group_list_vw
+WHERE group_id=$1
+AND is_public=1
+ORDER BY group_forum_id',
+							   array ($this->Group->getID())) ;
 			} else {
-				$public_flag='=1';
-				$exists = '';
-			}
-			
-			$sql="SELECT fgl.*,
-					(SELECT count(*) AS `count`
-						FROM (
-							SELECT DISTINCT group_forum_id, thread_id FROM forum
-						) AS tmp
-						WHERE tmp.group_forum_id = fgl.group_forum_id
-					) AS threads 
-			FROM forum_group_list_vw AS fgl
-			WHERE group_id='". $this->Group->getID() ."' 
-			AND is_public $public_flag 
-			$exists
-			ORDER BY group_forum_id;";
-			
-			$result = db_query_mysql ($sql);
-			
-			$rows = db_numrows($result);
-			
-			if (!$result) {
-				$this->setError(_('Forum not found').' : '.db_error());
-				$this->forums = false;
-			} else {
-				while ($arr = db_fetch_array($result)) {
-					$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
-				}
-			}
-			return $this->forums;
-		} else {	// Not MySQL
-			if (session_loggedin()) {
-				$perm =& $this->Group->getPermission( session_get_user() );
-				if (!$perm || !is_object($perm) || !$perm->isMember()) {
+				$public_flag='<3';
+				if ($perm->isForumAdmin()) {
 					$result = db_query_params ('SELECT * FROM forum_group_list_vw
 WHERE group_id=$1
-AND is_public=1
+AND is_public < 3
 ORDER BY group_forum_id',
 								   array ($this->Group->getID())) ;
 				} else {
-					$public_flag='<3';
-					if ($perm->isForumAdmin()) {
-						$result = db_query_params ('SELECT * FROM forum_group_list_vw
+					$result = db_query_params ('SELECT * FROM forum_group_list_vw
 WHERE group_id=$1
 AND is_public < 3
-ORDER BY group_forum_id',
-									   array ($this->Group->getID())) ;
-					} else {
-						$result = db_query_params ('SELECT * FROM forum_group_list_vw
-WHERE group_id=$1
-AND is_public < 3
 AND group_forum_id IN (SELECT role_setting.ref_id
                          FROM role_setting, user_group
                          WHERE role_setting.section_name = $2
@@ -166,31 +113,30 @@
 			 AND user_group.role_id = role_setting.role_id
 			 AND user_group.user_id=$3)
 ORDER BY group_forum_id',
-									   array ($this->Group->getID(),
-										  'forum',
-										  user_getid())) ;
-					}
+								   array ($this->Group->getID(),
+									  'forum',
+									  user_getid())) ;
 				}
-			} else {
-				$result = db_query_params ('SELECT * FROM forum_group_list_vw
+			}
+		} else {
+			$result = db_query_params ('SELECT * FROM forum_group_list_vw
 WHERE group_id=$1
 AND is_public=1
 ORDER BY group_forum_id',
-							   array ($this->Group->getID())) ;
+						   array ($this->Group->getID())) ;
+		}
+		
+		$rows = db_numrows($result);
+		
+		if (!$result) {
+			$this->setError(_('Forum not found').' : '.db_error());
+			$this->forums = false;
+		} else {
+			while ($arr = db_fetch_array($result)) {
+				$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
 			}
-
-			$rows = db_numrows($result);
-
-			if (!$result) {
-				$this->setError(_('Forum not found').' : '.db_error());
-				$this->forums = false;
-			} else {
-				while ($arr = db_fetch_array($result)) {
-					$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
-				}
-			}
-			return $this->forums;
 		}
+		return $this->forums;
 	}
 	
 	
@@ -207,73 +153,33 @@
 		}
 
 		
-		if ($sys_database_type == "mysql") {
-			if (session_loggedin()) {
-				$perm =& $this->Group->getPermission( session_get_user() );
-				if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
-					$this->setError(_("You don't have a permission to access this page"));
-					$this->forums = false;
-				} else {
-					$sql="SELECT fgl.*,
-							(SELECT count(*) AS `count`
-							FROM (
-								SELECT DISTINCT group_forum_id, thread_id FROM forum
-								) AS tmp
-							WHERE tmp.group_forum_id = fgl.group_forum_id
-							) AS threads 
-						FROM forum_group_list_vw AS fgl
-						WHERE group_id='". $this->Group->getID() . "'
-						ORDER BY group_forum_id;";
-					
-					$result = db_query_mysql ($sql);
-			
-					$rows = db_numrows($result);
-					
-					if (!$result) {
-						$this->setError(_('Forum not found').' : '.db_error());
-						$this->forums = false;
-					} else {
-						while ($arr = db_fetch_array($result)) {
-							$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
-						}
-					}
-				}
-			} else {
+		if (session_loggedin()) {
+			$perm =& $this->Group->getPermission( session_get_user() );
+			if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
 				$this->setError(_("You don't have a permission to access this page"));
 				$this->forums = false;
-			}
-			
-			return $this->forums;
-
-		} else {	// Not MySQL
-			if (session_loggedin()) {
-				$perm =& $this->Group->getPermission( session_get_user() );
-				if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
-					$this->setError(_("You don't have a permission to access this page"));
-					$this->forums = false;
-				} else {
-					$result = db_query_params ('SELECT * FROM forum_group_list_vw
+			} else {
+				$result = db_query_params ('SELECT * FROM forum_group_list_vw
 WHERE group_id=$1
 ORDER BY group_forum_id',
-									   array ($this->Group->getID())) ;
-				}
-			} else {
-				$this->setError(_("You don't have a permission to access this page"));
-				$this->forums = false;
+							   array ($this->Group->getID())) ;
 			}
-
-			$rows = db_numrows($result);
-
-			if (!$result) {
-				$this->setError(_('Forum not found').' : '.db_error());
-				$this->forums = false;
-			} else {
-				while ($arr = db_fetch_array($result)) {
-					$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
-				}
+		} else {
+			$this->setError(_("You don't have a permission to access this page"));
+			$this->forums = false;
+		}
+		
+		$rows = db_numrows($result);
+		
+		if (!$result) {
+			$this->setError(_('Forum not found').' : '.db_error());
+			$this->forums = false;
+		} else {
+			while ($arr = db_fetch_array($result)) {
+				$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
 			}
-			return $this->forums;
 		}
+		return $this->forums;
 	}
 }
 

Deleted: trunk/gforge/common/include/database-mysql.php
===================================================================
--- trunk/gforge/common/include/database-mysql.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/include/database-mysql.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -1,411 +0,0 @@
-<?php
-/**
- * FusionForge MySQL connection layer
- *
- * Copyright 1999-2001, VA Linux Systems, Inc.
- * Copyright 2007, Robert Nelson
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- * 
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/**
- *  db_connect() -  Connect to the database
- *
- *  Notice the global vars that must be set up
- *  Sets up a global $gfconn variable which is used 
- *  in other functions in this library
- */
-function db_connect() {
-	global $sys_dbhost, $sys_dbuser, $sys_dbpasswd, $gfconn;
-
-	db_log_entry('db_connect', NULL);
-
-	db_log_dbentry('mysqli_connect',"$sys_dbhost, $sys_dbuser, $sys_dbpasswd");
-	$gfconn = @mysqli_connect($sys_dbhost, $sys_dbuser, $sys_dbpasswd);
-	db_log_dbexit('mysqli_connect',"$gfconn");
-
-	//
-	//	Now map the physical database connections to the
-	//	"virtual" list that is used to distribute load in db_query()
-	// Define dummy values to eliminate log messages
-	//
-	define('SYS_DB_PRIMARY', 0);
-	define('SYS_DB_STATS', 1);
-	define('SYS_DB_TROVE', 2);
-	define('SYS_DB_SEARCH', 3);
-
-	db_log_exit('db_connect');
-
-	#return $gfconn;
-}
-
-/**
- *  db_query() - Query the database
- *
- *  @param		string	SQL statement
- *  @param		int		How many rows do you want returned
- *  @param		int		Of matching rows, return only rows starting here
- */
-function db_query_mysql($qstring, $limit = '-1', $offset = 0) {
-	global $sys_dbname, $gfconn;
-
-	db_log_entry('db_query',"$qstring, $limit, $offset");
-
-	if ($limit > 0) {
-		if (!$offset || $offset < 0) {
-			$offset=0;
-		}
-		$qstring=$qstring." LIMIT $offset,$limit";
-	}
-//	if ($GLOBALS['IS_DEBUG'])
-//		$GLOBALS['G_DEBUGQUERY'] .= $qstring . "<p><br />\n";
-
-	db_log_dbentry('mysqli_select_db',"$gfconn, $sys_dbname");
-	if (!mysqli_select_db($gfconn, $sys_dbname)) {
-		db_log_dbexit('mysqli_select_db',false);
-		db_log_exit('db_query');
-		return NULL;
-	}
-	db_log_dbexit('mysqli_select_db',true);
-
-	db_log_dbentry('mysqli_query',"$gfconn, $sys_dbname");
-	$res = mysqli_query($gfconn, $qstring);
-	db_log_dbexit('mysqli_query',$res);
-
-	db_log_exit('db_query',"$res");
-	return $res;
-}
-
-/**
- *  db_mquery() - Query the database supporting multi-statements
- *
- *  @param		string	SQL statement
- */
-function db_mquery($qstring) {
-	global $sys_dbname, $gfconn;
-
-//	if ($GLOBALS['IS_DEBUG'])
-//		$GLOBALS['G_DEBUGQUERY'] .= $qstring . "<p><br />\n";
-
-	db_log_entry('db_mquery',"$qstring");
-
-	db_log_dbentry('mysqli_select_db',"$gfconn, $sys_dbname");
-	if (!mysqli_select_db($gfconn, $sys_dbname)) {
-		db_log_dbexit('mysqli_select_db',false);
-		$err = mysqli_error($gfconn);
-		if ($err) {
-			db_log('DB Error = '.$err);
-		}
-		db_log_exit('db_mquery',NULL);
-		return NULL;
-	}
-	db_log_dbexit('mysqli_select_db', true);
-
-	db_log_dbentry('mysqli_multi_query',"$gfconn, $qstring");
-	if (!mysqli_multi_query($gfconn, $qstring)) {
-		db_log_dbexit('mysqli_multi_query','false');
-		$err = mysqli_error($gfconn);
-		if ($err) {
-			db_log('DB Error = '.$err);
-		}
-		db_log_exit('db_mquery');
-		return NULL;
-	}
-	db_log_dbexit('mysqli_multi_query',true);
-
-	db_log_dbentry('mysqli_store_result',"$gfconn");
-	if ($res = mysqli_store_result($gfconn)) {
-		db_log_dbexit('mysqli_store_result',"$res");
-		db_log_exit('db_mquery',"$res");
-		return $res;
-	} else {
-		$err = mysqli_error($gfconn);
-		if ($err) {
-			db_log('DB Error = '.$err);
-		}
-		db_log_dbexit('mysqli_store_result');
-	}
-	db_log_exit('db_mquery',true);
-	return true;
-}
-
-/**
- *  db_next_result() - Get the next result from query with multiple statements.
- *
- *  @param		string	SQL statement
- *  @param		int		How many rows do you want returned
- *  @param		int		Of matching rows, return only rows starting here
- */
-function db_next_result() {
-	global $gfconn;
-
-	db_log_entry('db_next_result',NULL);
-
-	db_log_dbentry('mysqli_next_result',"$gfconn");
-	$ret = mysqli_next_result($gfconn);
-	db_log_dbexit('mysqli_next_result',"$ret");
-	$err = mysqli_error($gfconn);
-	if ($err) {
-		db_log('DB Error = '.$err);
-	}
-
-	if ($ret) {
-		db_log_dbentry('mysqli_store_result',"$gfconn");
-		$res = mysqli_store_result($gfconn);
-		db_log_dbexit('mysqli_store_result',"$res");
-		if (!$res) {
-			$res = 1;
-		}
-	} else {
-		$err = mysqli_error($gfconn);
-		if ($err) {
-			db_log('DB Error = '.$err);
-		}
-		$res = NULL;
-	}
-	db_log_exit('db_next_result',$res);
-	return $res;
-}
-
-/**
- *	db_begin() - Begin a transaction
- *
- *	Begin a transaction for databases that support them
- *	may cause unexpected behavior in databases that don't
- */
-function db_begin() {
-	return db_query_mysql("BEGIN WORK");
-}
-
-/**
- * db_commit() - Commit a transaction
- *
- * Commit a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_commit() {
-	return db_query_mysql("COMMIT");
-}
-
-/**
- * db_rollback() - Roll back a transaction
- *
- * Rollback a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_rollback() {
-	return db_query_mysql("ROLLBACK");
-}
-
-/**
- *  db_numrows() - Returns the number of rows in this result set
- *
- *  @param		string	Query result set handle
- */
-function db_numrows($qhandle) {
-	// return only if qhandle exists, otherwise 0
-	if ($qhandle) {
-		return @mysqli_num_rows($qhandle);
-	} else {
-		return 0;
-	}
-}
-
-/**
- *  db_free_result() - Frees a database result properly 
- *
- *  @param		string	Query result set handle
- */
-function db_free_result($qhandle) {
-	db_log_entry('db_free_result',"$qhandle");
-	if (!is_object($qhandle)) {
-		db_log_exit('db_free_result');
-		return;
-	}
-	db_log_dbentry('mysqli_free_result',"$qhandle");
-	$res = mysqli_free_result($qhandle);
-	db_log_dbexit('mysqli_free_result',"$res");
-	db_log_exit('db_free_result');
-}
-
-/**
- *  db_reset_result() - Reset a result set.
- *
- *  Reset is useful for db_fetch_array sometimes you need to start over
- *
- *  @param		string	Query result set handle
- *  @param		int		Row number
- */
-function db_reset_result($qhandle,$row=0) {
-	return mysqli_data_seek($qhandle,$row);
-}
-
-/**
- *  db_result() - Returns a field from a result set
- *
- *  @param		string	Query result set handle
- *  @param		int		Row number
- *  @param		string	Field name
- */
-function db_result($qhandle,$row,$field) {
-
-	if (!mysqli_data_seek($qhandle,$row)) {
-		return NULL;
-	}
-
-	$row_data = mysqli_fetch_array($qhandle, MYSQLI_BOTH);
-	if (!$row_data) {
-		return NULL;
-	}
-	return $row_data[$field];
-}
-
-/**
- *  db_numfields() - Returns the number of fields in this result set
- *
- *  @param		string	Query result set handle
- */
-function db_numfields($lhandle) {
-	return mysqli_num_fields($lhandle);
-}
-
-/**
- *  db_fieldname() - Returns the name of a field in this result set
- *
- *  @param		string	Query result set handle
- *  @param		int		Column number
- */
-function db_fieldname($lhandle,$fnumber) {
-	$fieldinfo=mysqli_fetch_field_direct($lhandle,$fnumber);
-	if ($fieldinfo) {
-		return $fieldinfo->name;
-	} else {
-		return NULL;
-	}
-}
-
-/**
- *  db_affected_rows() - Returns the number of rows changed in the last query
- *
- *  @param		string	Query result set handle
- */
-function db_affected_rows() {
-	global $gfconn;
-
-	return mysqli_affected_rows($gfconn);
-}
-
-/**
- *  db_fetch_array() - Fetch an array
- *
- *  Returns an associative array from 
- *  the current row of this database result
- *  Use db_reset_result to seek a particular row
- *
- *  @param		string	Query result set handle
- */
-function db_fetch_array($qhandle) {
-	return @mysqli_fetch_array($qhandle);
-}
-
-/**
- *  db_insertid() - Returns the last primary key from an insert
- *
- *  @param		string	Query result set handle
- *  @param		string	Is the name of the table you inserted into
- *  @param		string	Is the field name of the primary key
- */
-function db_insertid($qhandle,$table_name,$pkey_field_name) {
-	global $gfconn;
-
-	return mysqli_insert_id($gfconn);
-}
-
-/**
- *  db_error() - Returns the last error from the database
- */
-function db_error() {
-	global $gfconn;
-
-	return mysqli_error($gfconn);
-}
-
-/**
- *	system_cleanup() - In the future, we may wish to do a number 
- *	of cleanup functions at script termination.
- *
- *	For now, we just abort any in-process transaction.
- */
-function system_cleanup() {
-	global $_sys_db_transaction_level;
-	if ($_sys_db_transaction_level > 0) {
-		echo "Open transaction detected!!!";
-		db_query_mysql("ROLLBACK");
-	}
-}
-
-function db_drop_table_if_exists ($tn) {
-	$sql = "DROP TABLE IF EXISTS $tn;";
-	$rel = db_query_mysql ($sql);
-	echo db_error();
-}
-
-function db_drop_sequence_if_exists ($tn) {
-}
-
-function db_log($message) {
-	global $fhlog;
-
-	if (!$fhlog) {
-		$fhlog = fopen('/tmp/db.log', 'a');
-	}
-
-	if ($fhlog) {
-		fwrite($fhlog, $message);
-		fflush($fhlog);
-	}
-}
-
-function db_log_entry($func, $args) {
-	db_log("\nEntered ".$func.'('.$args.")\n");
-}
-
-function db_log_exit($func, $result = NULL) {
-	db_log('Exited '.$func.' returned '.$result."\n");
-}
-
-function db_log_dbentry($func, $args) {
-	db_log('Entered '.$func.'('.$args.")\n");
-}
-
-function db_log_dbexit($func, $result = NULL) {
-	db_log('Exited '.$func.' returned '.$result."\n");
-	if (!$result) {
-		$err = db_error();
-		if ($err) {
-			db_log('Database error = '.$err."\n");
-		}
-	}
-}
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>

Modified: trunk/gforge/common/include/forms.php
===================================================================
--- trunk/gforge/common/include/forms.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/include/forms.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -37,21 +37,12 @@
 	// there's about 99.999999999% probability this loop will run only once :) 
 	while(!$is_new) {
 		$key = md5(microtime() + rand() + $_SERVER["REMOTE_ADDR"]);
-	    if ( $sys_database_type == "mysql" ) {
-			$sql = "SELECT * FROM form_keys WHERE `key`='".$key."'";
-			$res=db_query_mysql($sql);
-		} else {
-			$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1', array ($key));
-		}
+		$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1', array ($key));
 		if (!db_numrows($res)) {
 			$is_new=true;	
 		}
 	}
-	if ( $sys_database_type == "mysql" ) {
-		$res = db_query_mysql("INSERT INTO form_keys (`key`,is_used,creation_date) VALUES ('".$key."',0,".time().")");
-	} else {
-		$res = db_query_params('INSERT INTO form_keys (key,is_used,creation_date) VALUES ($1, 0, $2)', array ($key,time()));
-	}
+	$res = db_query_params('INSERT INTO form_keys (key,is_used,creation_date) VALUES ($1, 0, $2)', array ($key,time()));
 	if (!$res) {
 		db_rollback();
 		return false;
@@ -78,22 +69,12 @@
 		return true;
 
 	db_begin();
-	if ( $sys_database_type == "mysql" ) {
-		$sql = "SELECT * FROM form_keys WHERE `key`='$key' and is_used=0 FOR UPDATE";
-		$res=db_query_mysql($sql);
-	} else {
-		$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 and is_used=0 FOR UPDATE', array ($key));
-	}
+	$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 and is_used=0 FOR UPDATE', array ($key));
 	if (!$res || !db_numrows($res)) {
 		db_rollback();
 		return false;
 	}
-	if ( $sys_database_type == "mysql" ) {
-		$sql = "UPDATE form_keys SET is_used=1 WHERE `key`='$key'";
-		$res=db_query_mysql($sql);
-	} else {
-		$res = db_query_params ('UPDATE form_keys SET is_used=1 WHERE key=$1', array ($key));
-	}
+	$res = db_query_params ('UPDATE form_keys SET is_used=1 WHERE key=$1', array ($key));
 	if (!$res) {
 		db_rollback();
 		return false;
@@ -113,22 +94,12 @@
 	global $sys_database_type;
 
 	db_begin();
-	if ( $sys_database_type == "mysql" ) {
-		$sql = "SELECT * FROM form_keys WHERE `key`='$key' FOR UPDATE";
-		$res=db_query_mysql($sql);
-	} else {
-		$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 FOR UPDATE', array ($key));
-	}
+	$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 FOR UPDATE', array ($key));
 	if (!$res || !db_numrows($res)) {
 		db_rollback();
 		return false;
 	}
-	if ( $sys_database_type == "mysql" ) {
-		$sql = "UPDATE form_keys SET is_used=0 WHERE `key`='$key'";
-		$res=db_query_mysql($sql);
-	} else {
-		$res = db_query_params ('UPDATE form_keys SET is_used=0 WHERE key=$1', array ($key));
-	}
+	$res = db_query_params ('UPDATE form_keys SET is_used=0 WHERE key=$1', array ($key));
 	if (!$res) {
 		db_rollback();
 		return false;

Modified: trunk/gforge/common/pm/ProjectTask.class.php
===================================================================
--- trunk/gforge/common/pm/ProjectTask.class.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/pm/ProjectTask.class.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -163,69 +163,37 @@
 		}
 
 		db_begin();
-  		if ($sys_database_type == "mysql") {
-
-			$sql = "INSERT INTO project_task (group_project_id,created_by,summary,
-				details,start_date,end_date,status_id,category_id,priority,percent_complete,hours,duration,parent_id) 
-				VALUES ('".$this->ProjectGroup->getID()."','".user_getid()."','".htmlspecialchars( $summary )."',
-				'". htmlspecialchars($details) ."',	'$start_date','$end_date','1','$category_id','$priority','$percent_complete','$hours','$duration','$parent_id')";
-			
-			$result = db_query_mysql( $sql );
-			if (!$result || db_affected_rows($result) < 1) {
-				$this->setError( 'ProjectTask::create() Posting Failed '.db_error().$sql );
-				db_rollback();
-				return false;
-			}
-
-			$result = db_query_mysql( "SELECT last_insert_id() AS id" );
-			if (!$result) {
-				$this->setError( 'ProjectTask::create() Get Created ID Failed '.db_error().$sql );
-				db_rollback();
-				return false;
-			}
-
-			$project_task_id=db_result($result, 0, 'id');
-			if (!$project_task_id) {
-				$this->setError( 'ProjectTask::create() Created ID is NULL Failed' );
-				db_rollback();
-				return false;
-			}
-
-			$this->data_array['project_task_id']=$project_task_id;
-
-		} else {
-			$res = db_query_params ('SELECT nextval($1) AS id', 
-						array ('project_task_pk_seq'));
-			if (!$project_task_id=db_result($res,0,'id')) {
-				$this->setError( 'Could Not Get Next Project Task ID' );
-				db_rollback();
-				return false;
-			}
-
-			$this->data_array['project_task_id']=$project_task_id;
-
-			$result = db_query_params ('INSERT INTO project_task (project_task_id,group_project_id,created_by,summary,details,start_date,end_date,status_id,category_id,priority,percent_complete,hours,duration,parent_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)',
-						   array ($project_task_id,
-							  $this->ProjectGroup->getID(),
-							  user_getid(),
-							  htmlspecialchars($summary),
-							  htmlspecialchars($details),
-							  $start_date,
-							  $end_date,
-							  1,
-							  $category_id,
-							  $priority,
-							  $percent_complete,
-							  $hours,
-							  $duration,
-							  $parent_id)) ;
-
-			if (!$result || db_affected_rows($result) < 1) {
-				$this->setError('ProjectTask::create() Posting Failed '.db_error().$sql);
-				db_rollback();
-				return false;
-			}
+		$res = db_query_params ('SELECT nextval($1) AS id', 
+					array ('project_task_pk_seq'));
+		if (!$project_task_id=db_result($res,0,'id')) {
+			$this->setError( 'Could Not Get Next Project Task ID' );
+			db_rollback();
+			return false;
 		}
+		
+		$this->data_array['project_task_id']=$project_task_id;
+		
+		$result = db_query_params ('INSERT INTO project_task (project_task_id,group_project_id,created_by,summary,details,start_date,end_date,status_id,category_id,priority,percent_complete,hours,duration,parent_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)',
+					   array ($project_task_id,
+						  $this->ProjectGroup->getID(),
+						  user_getid(),
+						  htmlspecialchars($summary),
+						  htmlspecialchars($details),
+						  $start_date,
+						  $end_date,
+						  1,
+						  $category_id,
+						  $priority,
+						  $percent_complete,
+						  $hours,
+						  $duration,
+						  $parent_id)) ;
+		
+		if (!$result || db_affected_rows($result) < 1) {
+			$this->setError('ProjectTask::create() Posting Failed '.db_error().$sql);
+			db_rollback();
+			return false;
+		}
 
 		if (!$this->setDependentOn($depend_arr)) {
 			db_rollback();

Modified: trunk/gforge/common/reporting/ReportSetup.class.php
===================================================================
--- trunk/gforge/common/reporting/ReportSetup.class.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/reporting/ReportSetup.class.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -55,12 +55,8 @@
 		report_date int not null,
 		user_id int not null,
 		project_task_id int not null,
-		time_code int not null";
-
-	if ($sys_database_type != "mysql") {
-		$sql1.=" CONSTRAINT reptimetrk_timecode REFERENCES rep_time_category(time_code)";
-	}
-	$sql1.=",hours float not null);";
+		time_code int not null CONSTRAINT reptimetrk_timecode REFERENCES rep_time_category(time_code),
+                hours float not null);";
 	$sql[]=$sql1;
 //	$sql[]="CREATE UNIQUE INDEX reptimetrk_weekusrtskcde ON 
 //		rep_time_tracking (week,user_id,project_task_id,time_code);";

Modified: trunk/gforge/common/reporting/report_utils.php
===================================================================
--- trunk/gforge/common/reporting/report_utils.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/reporting/report_utils.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -97,14 +97,10 @@
 	global $sys_database_type;
 
 	if ($start_with) {
-		if ( $sys_database_type == "mysql" ) {
-			$res = db_query_mysql ("SELECT user_id,realname FROM users WHERE status='A' AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lower(lastname) LIKE lower('$start_with%') OR lower(user_name) LIKE lower('$start_with%')) ORDER BY lastname") ;
-		} else {
-			$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
-						array ('A',
-						       strtolower("$start_with%"),
-						       strtolower("$start_with%"))) ;
-		}
+		$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
+					array ('A',
+					       strtolower("$start_with%"),
+					       strtolower("$start_with%"))) ;
 	} else {
 		$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) ORDER BY lastname',
 					array ('A')) ;
@@ -116,14 +112,10 @@
 	global $sys_database_type;
 
 	if ($start_with) {
-		if ( $sys_database_type == "mysql" ) {
-			$res = db_query_mysql ("SELECT user_id,realname FROM users WHERE status='A' AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lower(lastname) LIKE lower('$start_with%') OR lower(user_name) LIKE lower('$start_with%')) ORDER BY lastname") ;
-		} else {
-			$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
-						array ('A',
-						       strtolower("$start_with%"),
-						       strtolower("$start_with%"))) ;
-		}
+		$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
+					array ('A',
+					       strtolower("$start_with%"),
+					       strtolower("$start_with%"))) ;
 	} else {
 		$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) ORDER BY lastname',
 					array ('A')) ;

Modified: trunk/gforge/common/search/ArtifactSearchQuery.class.php
===================================================================
--- trunk/gforge/common/search/ArtifactSearchQuery.class.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/common/search/ArtifactSearchQuery.class.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -133,14 +133,9 @@
 							 ' GROUP BY a.artifact_id) x, artifact a, users WHERE a.artifact_id=x.artifact_id AND users.user_id=a.submitted_by ORDER BY group_artifact_id ASC, rank DESC, a.artifact_id ASC') ;
 			}
 		} else {
-			if ($sys_database_type == "mysql") {
-				$qpa = db_construct_qpa ($qpa,
-							 'SELECT DISTINCT a.group_artifact_id,a.artifact_id,a.summary,a.open_date,users.realname ') ;
-			} else {
-				$qpa = db_construct_qpa ($qpa,
-							 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id,a.artifact_id,a.summary,a.open_date,users.realname ') ;
-			}
 			$qpa = db_construct_qpa ($qpa,
+						 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id,a.artifact_id,a.summary,a.open_date,users.realname ') ;
+			$qpa = db_construct_qpa ($qpa,
 						 'FROM artifact a LEFT OUTER JOIN artifact_message am USING (artifact_id), users WHERE a.group_artifact_id=$1 AND users.user_id=a.submitted_by AND ((',
 						 array ($this->artifactId)) ;
 			
@@ -167,14 +162,9 @@
 
 		$qpa = db_construct_qpa () ;
 
-		if ($sys_database_type == "mysql") {
-			$qpa = db_construct_qpa ($qpa,
-						 'SELECT DISTINCT a.group_artifact_id, a.artifact_id') ;
-		} else {
-			$qpa = db_construct_qpa ($qpa,
-						 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id, a.artifact_id') ;
-		}
 		$qpa = db_construct_qpa ($qpa,
+					 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id, a.artifact_id') ;
+		$qpa = db_construct_qpa ($qpa,
 					 ' FROM artifact a WHERE a.group_artifact_id=$1 AND a.artifact_id=$2',
 					 array ($this->artifactId,
 						$this->searchId)) ;

Modified: trunk/gforge/cronjobs/calculate_user_metric.php
===================================================================
--- trunk/gforge/cronjobs/calculate_user_metric.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/calculate_user_metric.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -69,16 +69,12 @@
 
 db_query_params ('DELETE FROM user_metric0',
 			array()) ;
+$err .= db_error();
 
+db_query_params ('select setval($1,1)',
+		 array('user_metric0_pk_seq')) ;
 $err .= db_error();
 
-if ($sys_database_type != 'mysql') {
-	db_query_params ('select setval($1,1)',
-			array('user_metric0_pk_seq')) ;
-
-	$err .= db_error();
-}
-
 db_query_params ('INSERT INTO user_metric0 
 (user_id,times_ranked,avg_raters_importance,avg_rating,metric,percentile,importance_factor)
 SELECT user_id,5,1.25,3,0,0,1.25
@@ -237,18 +233,12 @@
 	// Only do final percentile if row count is not zero
 	if (db_result($res,0,0)) {
 
-	    /*
-	    	Update with final percentile and importance
-	    */
-		if ($sys_database_type == 'mysql') {
-			$sql="UPDATE user_metric_next SET
-			percentile=(100-(100*((ranking-1.0)/". db_result($res,0,0) .")))";
-			$res = db_query_mysql ($sql);
-		} else {
-			$res = db_query_params ('UPDATE user_metric_next SET
+		/*
+		 Update with final percentile and importance
+		*/
+		$res = db_query_params ('UPDATE user_metric_next SET
 			percentile=(100-(100*((ranking::float-1)/$1)))',
-						array (db_result($res,0,0))) ;
-		}
+					array (db_result($res,0,0))) ;
 	    if (!$res || db_affected_rows($res) < 1) {
 		$err .= "Error in round $i setting percentile: " . db_error();
 		exit;

Modified: trunk/gforge/cronjobs/check_stale_tracker_items.php
===================================================================
--- trunk/gforge/cronjobs/check_stale_tracker_items.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/check_stale_tracker_items.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -33,20 +33,14 @@
 require $gfwww.'include/squal_pre.php';
 require $gfcommon.'include/cron_utils.php';
 
-if ($sys_database_type == 'mysql') {
-	$res = db_query_mysql ('UPDATE artifact NATURAL JOIN artifact_group_list SET status_id = 2
-			WHERE (status_timeout + close_date) < now() AND status_id = 4');
-} else {
-	$res = db_query_params ('UPDATE artifact SET status_id = 2
+$res = db_query_params ('UPDATE artifact SET status_id = 2
 			WHERE artifact_id IN (
 				SELECT artifact_id
 				FROM artifact a NATURAL JOIN artifact_group_list agl
 				WHERE (agl.status_timeout + a.close_date) < $1
 				AND a.status_id=4)',
-				array (time()));
-}
+			array (time()));
 
-
 cron_entry(2,db_error());
 
 // Local Variables:

Modified: trunk/gforge/cronjobs/db_project_sums.php
===================================================================
--- trunk/gforge/cronjobs/db_project_sums.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/db_project_sums.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -71,12 +71,6 @@
 	}
 	
 	db_commit();
-	
-	if ($sys_database_type != 'mysql') {
-		db_query_params ('VACUUM ANALYZE forum_agg_msg_count',
-				 array()) ;
-		
-	}
 }
 
 /*
@@ -109,11 +103,6 @@
 	$err .= db_error();
 	
 	db_commit();
-
-	if ($sys_database_type != 'mysql') {
-		db_query_params ('VACUUM ANALYZE artifact_counts_agg',
-				 array()) ;
-	}
 }
 
 /*
@@ -181,15 +170,6 @@
 db_commit();
 $err .= db_error();
 
-if ($sys_database_type != 'mysql') {
-	db_query_params ('VACUUM ANALYZE project_sums_agg',
-			 array()) ;
-
-	if (db_error()) {
-		$err .= "Error: ".db_error();
-	}
-}
-
 cron_entry(3,$err);
 
 ?>

Modified: trunk/gforge/cronjobs/db_stats_agg.php
===================================================================
--- trunk/gforge/cronjobs/db_stats_agg.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/db_stats_agg.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -43,39 +43,7 @@
 			array ());
 $err .= db_error();
 
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO stats_project_months
-	SELECT month, group_id, 
-	avg(developers) AS developers, avg(group_ranking) AS group_ranking, 
-	avg(group_metric) AS group_metric,
-	sum(logo_showings) AS logo_showings,
-	sum(downloads) AS downloads,
-	sum(site_views) AS site_views ,
-	sum(subdomain_views) AS subdomain_views,
-	sum(page_views) AS page_views,
-	sum(file_releases) AS file_releases,
-	sum(msg_posted) AS msg_posted,
-	sum(msg_uniq_auth) AS msg_uniq_auth,
-	sum(bugs_opened) AS bugs_opened,
-	sum(bugs_closed) AS bugs_closed,
-	sum(support_opened) AS support_opened,
-	sum(support_closed) AS support_closed,
-	sum(patches_opened) AS patches_opened,
-	sum(patches_closed) AS patches_closed,
-	sum(artifacts_opened) AS artifacts_opened,
-	sum(artifacts_closed) AS artifacts_closed,
-	sum(tasks_opened) AS tasks_opened,
-	sum(tasks_closed) AS tasks_closed,
-	sum(help_requests) AS help_requests,
-	sum(cvs_checkouts) AS cvs_checkouts,
-	sum(cvs_commits) AS cvs_commits,
-	sum(cvs_adds) AS cvs_adds
-FROM stats_project_vw
-GROUP BY month,group_id
-";
-	$res = db_query_mysql ($sql);
-} else {
-	$res = db_query_params ('INSERT INTO stats_project_months
+$res = db_query_params ('INSERT INTO stats_project_months
 	SELECT month, group_id,
 	avg(developers)::int AS developers, avg(group_ranking)::int AS group_ranking, 
 	avg(group_metric) AS group_metric,
@@ -103,8 +71,7 @@
 	sum(cvs_adds) AS cvs_adds
 FROM stats_project_vw
 GROUP BY month,group_id',
-			 array ()) ;
-}
+			array ()) ;
 $err .= db_error();
 
 db_commit();

Modified: trunk/gforge/cronjobs/project_weekly_metric.php
===================================================================
--- trunk/gforge/cronjobs/project_weekly_metric.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/project_weekly_metric.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -57,71 +57,39 @@
 
 
 #forum messages
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT forum_group_list.group_id,'forum',3*log(1+count(forum.msg_id)) AS count FROM forum,forum_group_list
-WHERE forum.group_forum_id=forum_group_list.group_forum_id
-AND post_date > '$last_week'
-AND post_date < '$this_week'
-GROUP BY group_id";
-	$rel = db_query_mysql ($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT forum_group_list.group_id,$1,3*log(1+count(forum.msg_id)::float) AS count
 FROM forum,forum_group_list
 WHERE forum.group_forum_id=forum_group_list.group_forum_id
 AND post_date > $2
 AND post_date < $3
 GROUP BY group_id',
-				array('forum',
-				      $last_week,
-				      $this_week));
-}
+			array('forum',
+			      $last_week,
+			      $this_week));
 
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 #project manager tasks
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT project_group_list.group_id,'tasks',4*log(1+count(project_task.project_task_id)) AS count
-FROM project_task,project_group_list
-WHERE project_task.group_project_id=project_group_list.group_project_id
-AND end_date > '$last_week'
-AND end_date < '$this_week'
-GROUP BY group_id";
-	$rel = db_query_mysql ($sql) ;
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT project_group_list.group_id,$1,4*log(1+count(project_task.project_task_id)::float) AS count
 FROM project_task,project_group_list
 WHERE project_task.group_project_id=project_group_list.group_project_id
 AND end_date > $2
 AND end_date < $3
 GROUP BY group_id',
-				array('tasks',
-				      $last_week,
-				      $this_week));
-}
+			array('tasks',
+			      $last_week,
+			      $this_week));
 
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 #bugs
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT agl.group_id,'bugs',3*log(1+count(*)) AS count
-FROM artifact_group_list agl,artifact a
-WHERE a.open_date > '$last_week'
-AND a.open_date < '$this_week'
-AND a.group_artifact_id=agl.group_artifact_id
-AND agl.datatype='1'
-GROUP BY agl.group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT agl.group_id,$1,3*log(1+count(*)::float) AS count
 FROM artifact_group_list agl,artifact a
 WHERE a.open_date > $2
@@ -129,29 +97,17 @@
 AND a.group_artifact_id=agl.group_artifact_id
 AND agl.datatype=$4
 GROUP BY agl.group_id',
-				array('bugs',
-				      $last_week,
-				      $this_week,
-				      '1'));
-}
+			array('bugs',
+			      $last_week,
+			      $this_week,
+			      '1'));
 
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 #patches
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT agl.group_id,'patches',10*log(1+count(*)) AS count
-FROM artifact_group_list agl,artifact a
-WHERE a.open_date > '$last_week'
-AND a.open_date < '$this_week'
-AND a.group_artifact_id=agl.group_artifact_id
-AND agl.datatype='3'
-GROUP BY agl.group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT agl.group_id,$1,10*log(1+count(*)::float) AS count
 FROM artifact_group_list agl,artifact a
 WHERE a.open_date > $2
@@ -159,28 +115,16 @@
 AND a.group_artifact_id=agl.group_artifact_id
 AND agl.datatype=$4
 GROUP BY agl.group_id',
-				array('patches',
-				      $last_week,
-				      $this_week,
-				      '3'));
-}
+			array('patches',
+			      $last_week,
+			      $this_week,
+			      '3'));
 if (!$rel) {
 	$err .= "\n\n***ERROR: \n\n".db_error();
 }
 
 #support
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT agl.group_id,'support',5*log(1+count(*)) AS count
-FROM artifact_group_list agl,artifact a
-WHERE a.open_date > '$last_week'
-AND a.open_date < '$this_week'
-AND a.group_artifact_id=agl.group_artifact_id
-AND agl.datatype='2'
-GROUP BY agl.group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT agl.group_id,$1,5*log(1+count(*)::float) AS count
 FROM artifact_group_list agl,artifact a
 WHERE a.open_date > $2
@@ -188,63 +132,41 @@
 AND a.group_artifact_id=agl.group_artifact_id
 AND agl.datatype=$4
 GROUP BY agl.group_id',
-				array('support',
-				      $last_week,
-				      $this_week,
-				      '2'));
-}
+			array('support',
+			      $last_week,
+			      $this_week,
+			      '2'));
 
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 #commits
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT group_id,'cvs',log(1+sum(commits)) AS count
-FROM stats_cvs_group
-WHERE ((month = '$last_year$last_month' AND day >= '$last_day') OR (month > '$last_year$last_month'))
-AND commits > 0
-GROUP BY group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT group_id,$1,log(1+sum(commits)::float) AS count
 FROM stats_cvs_group
 WHERE ((month = $2 AND day >= $3) OR (month > $4))
 AND commits > 0
 GROUP BY group_id',
-				array('cvs',
-				      "$last_year$last_month",
-				      $last_day,
-				      "$last_year$last_month"));
-}
+			array('cvs',
+			      "$last_year$last_month",
+			      $last_day,
+			      "$last_year$last_month"));
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 #file releases
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT frs_package.group_id,'filereleases',log(5 * count(*))
-FROM frs_release,frs_package
-WHERE frs_package.package_id = frs_release.package_id
-AND frs_release.release_date > '$last_week'
-AND frs_release.release_date < '$this_week'
-GROUP BY frs_package.group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT frs_package.group_id,$1,log(5 * count(*)::float)
 FROM frs_release,frs_package
 WHERE frs_package.package_id = frs_release.package_id
 AND frs_release.release_date > $2
 AND frs_release.release_date < $3
 GROUP BY frs_package.group_id',
-				array('filereleases',
-				      $last_week,
-				      $this_week));
-}
+			array('filereleases',
+			      $last_week,
+			      $this_week));
 
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
@@ -253,36 +175,25 @@
 db_begin();
 
 #file downloads
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_counts_weekly_tmp
-SELECT group_id,'downloads', .3*log(1+sum(downloads)) AS downloads
-FROM frs_dlstats_group_vw
-WHERE (month = '$last_year$last_month' AND day >= '$last_day') OR (month > '$last_year$last_month')
-GROUP BY group_id";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
+$rel = db_query_params ('INSERT INTO project_counts_weekly_tmp
 SELECT group_id,$1, .3*log(1+sum(downloads)::float) AS downloads
 FROM frs_dlstats_group_vw
 WHERE (month = $2 AND day >= $3) OR (month > $4)
 GROUP BY group_id',
-				array('downloads',
-				      "$last_year$last_month",
-				      $last_day,
-				      "$last_year$last_month"));
-}
+			array('downloads',
+			      "$last_year$last_month",
+			      $last_day,
+			      "$last_year$last_month"));
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
 
 db_commit();
 
-if ($sys_database_type != 'mysql') {
-	$rel = db_query_params ('CREATE SEQUENCE project_metric_weekly_seq',
+$rel = db_query_params ('CREATE SEQUENCE project_metric_weekly_seq',
 			array ());
-	if (!$rel) {
-		$err .= "\n\n***ERROR: \n\n".db_error();
-	}
+if (!$rel) {
+	$err .= "\n\n***ERROR: \n\n".db_error();
 }
 
 #create a new table to insert the final records into
@@ -326,19 +237,11 @@
 }
 db_commit();
 
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO project_weekly_metric (ranking,percentile,group_id)
-SELECT ranking,100-(100*((ranking-1)/$counts)),group_id
-FROM project_metric_weekly_tmp1
-ORDER BY ranking ASC";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO project_weekly_metric (ranking,percentile,group_id)
+$rel = db_query_params ('INSERT INTO project_weekly_metric (ranking,percentile,group_id)
 SELECT ranking,100-(100*((ranking::float-1)/$1)),group_id
 FROM project_metric_weekly_tmp1
 ORDER BY ranking ASC',
-				array($counts));
-}
+			array($counts));
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }
@@ -351,18 +254,11 @@
 		 array("$this_year$this_month",
 		       "$this_day"));
 
-if ($sys_database_type == 'mysql') {
-	$sql="INSERT INTO stats_project_metric (month,day,group_id,ranking,percentile)
-SELECT '$this_year$this_month', '$this_day',group_id,ranking,percentile
-FROM project_weekly_metric";
-	$rel = db_query_mysql($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO stats_project_metric (month,day,group_id,ranking,percentile)
+$rel = db_query_params ('INSERT INTO stats_project_metric (month,day,group_id,ranking,percentile)
 SELECT $1::int, $2::int,group_id,ranking,percentile
 FROM project_weekly_metric',
-				array("$this_year$this_month",
-				      $this_day));
-}
+			array("$this_year$this_month",
+			      $this_day));
 if (!$rel) {
 	$err .= "\n\n***ERROR:\n\n".db_error();
 }

Modified: trunk/gforge/cronjobs/site_stats.php
===================================================================
--- trunk/gforge/cronjobs/site_stats.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/site_stats.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -62,16 +62,11 @@
 			array ("$year$month",
 				$day));
 $err .= db_error();
-if ($sys_database_type == 'mysql') {
-	$sql = "INSERT INTO stats_agg_logo_by_group SELECT '$year$month' AS month, '$day' AS newday,group_id,count(*) AS count FROM activity_log WHERE type=0 AND day='$yesterday_formatted' GROUP BY month,newday,group_id";
-	$rel = db_query_mysql ($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO stats_agg_logo_by_group SELECT $1::int AS month, $2::int AS newday,group_id,count(*) AS count
+$rel = db_query_params ('INSERT INTO stats_agg_logo_by_group SELECT $1::int AS month, $2::int AS newday,group_id,count(*) AS count
 	FROM activity_log WHERE type=0 AND day=$3 GROUP BY month,newday,group_id',
-				array ("$year$month",
-				       $day,
-				       $yesterday_formatted)) ;
-}
+			array ("$year$month",
+			       $day,
+			       $yesterday_formatted)) ;
 $err .= db_error();
 
 
@@ -84,18 +79,10 @@
 			array ("$year$month",
 				$day));
 $err .= db_error();
-if ($sys_database_type == 'mysql') {
-	$sql = "INSERT INTO stats_agg_site_by_group ";
-	$sql .= "SELECT '$year$month' AS month, '$day' AS newday,group_id,COUNT(*) AS count";
-	$sql .= "
-	FROM activity_log WHERE type=0 AND day='$yesterday_formatted' GROUP BY month,newday,group_id";
-	$rel = db_query_mysql ($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO stats_agg_site_by_group SELECT $1::int AS month, $2::int AS newday,group_id,COUNT(*) AS count FROM activity_log WHERE type=0 AND day=$3 GROUP BY month,newday,group_id',
-				array ("$year$month",
-				       $day,
-				       $yesterday_formatted)) ;
-}
+$rel = db_query_params ('INSERT INTO stats_agg_site_by_group SELECT $1::int AS month, $2::int AS newday,group_id,COUNT(*) AS count FROM activity_log WHERE type=0 AND day=$3 GROUP BY month,newday,group_id',
+			array ("$year$month",
+			       $day,
+			       $yesterday_formatted)) ;
 $err .= db_error();
 
 
@@ -107,15 +94,10 @@
 			array ("$year$month",
 				$day));
 $err .= db_error();
-if ($sys_database_type == 'mysql') {
-	$sql = "INSERT INTO stats_site_pages_by_day (month,day,site_page_views) SELECT '$year$month' AS month, '$day' AS newday, count(*) AS count FROM activity_log WHERE type=0 AND day='$yesterday_formatted' GROUP BY month,newday";
-	$rel = db_query_mysql ($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO stats_site_pages_by_day (month,day,site_page_views) SELECT $1::int AS month, $2::int AS newday, count(*) AS count FROM activity_log WHERE type=0 AND day=$3 GROUP BY month,newday',
-				array ("$year$month",
-				       $day,
-				       $yesterday_formatted)) ;
-}
+$rel = db_query_params ('INSERT INTO stats_site_pages_by_day (month,day,site_page_views) SELECT $1::int AS month, $2::int AS newday, count(*) AS count FROM activity_log WHERE type=0 AND day=$3 GROUP BY month,newday',
+			array ("$year$month",
+			       $day,
+			       $yesterday_formatted)) ;
 $err .= db_error();
 
 
@@ -127,14 +109,9 @@
 			array ("$year$month",
 				$day));
 $err .= db_error();
-if ($sys_database_type == 'mysql') {
-	$sql = "INSERT INTO stats_project_developers (month,day,group_id,developers) SELECT '$year$month' AS month,'$day' AS day,group_id,count(*) AS count FROM user_group GROUP BY month,day,group_id";
-	$rel = db_query_mysql ($sql);
-} else {
-	$rel = db_query_params ('INSERT INTO stats_project_developers (month,day,group_id,developers) SELECT $1::int AS month,$2::int AS day,group_id,count(*) AS count FROM user_group GROUP BY month,day,group_id',
-				array ("$year$month",
-				       $day));
-}
+$rel = db_query_params ('INSERT INTO stats_project_developers (month,day,group_id,developers) SELECT $1::int AS month,$2::int AS day,group_id,count(*) AS count FROM user_group GROUP BY month,day,group_id',
+			array ("$year$month",
+			       $day));
 $err .= db_error();
 
 db_commit();

Modified: trunk/gforge/cronjobs/vacuum.php
===================================================================
--- trunk/gforge/cronjobs/vacuum.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/cronjobs/vacuum.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -36,14 +36,12 @@
 //
 //	PG 7.2 and 7.3
 //
-if ($sys_database_type != 'mysql') {
-	$res = db_query_params ('VACUUM FULL ANALYZE;',
+$res = db_query_params ('VACUUM FULL ANALYZE;',
 			array()) ;
+			 
 
-
-	if (!$res) {
-		$err .= "Error on DB1: " . db_error();
-	}
+if (!$res) {
+	$err .= "Error on DB1: " . db_error();
 }
 
 cron_entry(12,$err);

Deleted: trunk/gforge/mkadmin-mysql.sh
===================================================================
--- trunk/gforge/mkadmin-mysql.sh	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/mkadmin-mysql.sh	2010-04-14 19:31:21 UTC (rev 9487)
@@ -1,9 +0,0 @@
-USER_NAME=$1
-shift
-mysql $* <<EOD
-USE gforge;
-INSERT INTO user_group
-	(user_id,group_id,admin_flags)
-VALUES
-	((SELECT user_id FROM users WHERE user_name='$USER_NAME'),1,'A');
-EOD

Modified: trunk/gforge/plugins/webcalendar/www/includes/config.php
===================================================================
--- trunk/gforge/plugins/webcalendar/www/includes/config.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/plugins/webcalendar/www/includes/config.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -79,12 +79,8 @@
 
 global $sys_database_type,$sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname;
 
-if ( $sys_database_type == 'pgsql' ){
-        $db_type = 'postgresql';
-	$settings['db_type'] = 'postgresql';
-} else {
-	$settings['db_type'] = 'mysql';
-}
+$db_type = 'postgresql';
+$settings['db_type'] = 'postgresql';
 $settings['db_host'] = $sys_dbhost;
 $settings['db_database'] = $sys_dbname;
 $settings['db_login'] = $sys_dbuser;

Modified: trunk/gforge/www/frs/include/frs_utils.php
===================================================================
--- trunk/gforge/www/frs/include/frs_utils.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/www/frs/include/frs_utils.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -186,17 +186,10 @@
 		return 'ERROR - GROUP ID REQUIRED';
 	} else {
 		if (!isset($FRS_RELEASE_RES)) {
-			if ($sys_database_type == "mysql") {
-				$sql = "SELECT frs_release.release_id,concat(frs_package.name,' : ',frs_release.name) ";
-			} else {
-				$sql = "SELECT frs_release.release_id,(frs_package.name || ' : ' || frs_release.name) ";
-			}
-			$sql .=
-				"FROM frs_release,frs_package 
+			$FRS_RELEASE_RES = db_query_params("SELECT frs_release.release_id,(frs_package.name || ' : ' || frs_release.name) FROM frs_release,frs_package 
 WHERE frs_package.group_id=$1 
-AND frs_release.package_id=frs_package.package_id";
-
-			$FRS_RELEASE_RES = db_query_params($sql,array($group_id));
+AND frs_release.package_id=frs_package.package_id", 
+							   array($group_id));
 			echo db_error();
 		}
 		return html_build_select_box($FRS_RELEASE_RES,$name,$checked_val,false);

Modified: trunk/gforge/www/pm/msproject/msp.php
===================================================================
--- trunk/gforge/www/pm/msproject/msp.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/www/pm/msproject/msp.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -37,29 +37,17 @@
 	if ($success) {
 		$array['success']=true;
 		$array['session_hash']=$session_ser;
-	    if ( $sys_database_type == "mysql" ) {
-		    $sql="SELECT pgl.group_project_id, CONCAT(g.group_name, ': ', pgl.project_name) AS name
+		$res=db_query_params ('SELECT pgl.group_project_id, g.group_name || $1 || pgl.project_name AS name
 			FROM groups g, project_group_list pgl, role_setting rs, user_group ug
-			WHERE ug.user_id='".user_getid()."' 
-			AND g.group_id=pgl.group_id
-			AND rs.value::integer > 0
-			AND rs.group_project_id = pgl.group_project_id
-                        AND ug.role_id = rs.role_id
-                        AND rs.section_name='pm'";
-		    $res=db_query_mysql($sql);
-	    } else {
-		    $res=db_query_params ('SELECT pgl.group_project_id, g.group_name || $1 || pgl.project_name AS name
-			FROM groups g, project_group_list pgl, role_setting rs, user_group ug
 			WHERE ug.user_id=$2
 			AND g.group_id=pgl.group_id
 			AND rs.value::integer > 0
 			AND rs.group_project_id = pgl.group_project_id
                         AND ug.role_id = rs.role_id
                         AND rs.section_name=$3',
-					  array(': ',
-						user_getid(),
-						'pm'));
-		}
+				      array(': ',
+					    user_getid(),
+					    'pm'));
 		$rows=db_numrows($res);
 		if (!$res || $rows<1) {
 			$array['success']=false;

Modified: trunk/gforge/www/reporting/timeadd.php
===================================================================
--- trunk/gforge/www/reporting/timeadd.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/www/reporting/timeadd.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -103,43 +103,18 @@
 	report_header(_('Time tracking'));
 
 	if (!$group_project_id) {
-		if ( $sys_database_type == "mysql" ) {
-			$sql = "SELECT pgl.group_project_id,CONCAT(g.group_name, '**', pgl.project_name)
+		$respm = db_query_params ('SELECT pgl.group_project_id,g.group_name || $1 || pgl.project_name 
 		FROM groups g, project_group_list pgl, user_group ug
-		WHERE ug.user_id='".user_getid()."'
-		AND ug.group_id=g.group_id
-		AND g.group_id=pgl.group_id
-		ORDER BY group_name,project_name";
-			$respm = db_query_mysql($sql);
-		} else {
-			$respm = db_query_params ('SELECT pgl.group_project_id,g.group_name || $1 || pgl.project_name 
-		FROM groups g, project_group_list pgl, user_group ug
 		WHERE ug.user_id=$2
 		AND ug.group_id=g.group_id
 		AND g.group_id=pgl.group_id
 		ORDER BY group_name,project_name',
-						  array ('**',
-							 user_getid()));
-		}
+					  array ('**',
+						 user_getid()));
 	}
 	?>
 		<h3><?php printf(_('Time Entries For The Week Starting %s'), date(_('Y-m-d'),$week)) ?></h3>
 <p><?php
-if ( $sys_database_type == "mysql" ) {
-
-	$res = db_query_mysql ("SELECT pt.project_task_id, CONCAT(pgl.project_name, '**', pt.summary) AS name, 
-	rtt.hours, rtt.report_date, rtc.category_name, rtt.time_code
-	FROM groups g, project_group_list pgl, project_task pt, rep_time_tracking rtt,
-	rep_time_category rtc
-	WHERE rtt.week=$week
-			AND rtt.time_code=rtc.time_code
-	AND rtt.user_id=".user_getid()."
-			AND g.group_id=pgl.group_id
-	AND pgl.group_project_id=pt.group_project_id
-	AND pt.project_task_id=rtt.project_task_id
-	ORDER BY rtt.report_date");
-} else {
-
 	$res = db_query_params ('SELECT pt.project_task_id, pgl.project_name || $1 || pt.summary AS name, 
 	rtt.hours, rtt.report_date, rtc.category_name, rtt.time_code
 	FROM groups g, project_group_list pgl, project_task pt, rep_time_tracking rtt,
@@ -155,7 +130,6 @@
 				       $week,
 				       user_getid()));
 }
-}
 $rows=db_numrows($res);
 if ($group_project_id || $rows) {
 

Modified: trunk/gforge/www/survey/admin/show_results_aggregate.php
===================================================================
--- trunk/gforge/www/survey/admin/show_results_aggregate.php	2010-04-14 14:15:41 UTC (rev 9486)
+++ trunk/gforge/www/survey/admin/show_results_aggregate.php	2010-04-14 19:31:21 UTC (rev 9487)
@@ -128,19 +128,10 @@
 
 		//	average
 		if ($response_count > 0){
-			if ( $sys_database_type == "mysql" ) {
-
-			$result2 = db_query_params ('SELECT avg(response) AS avg FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3 AND response IN (1,2,3,4,5)',
-						    array ($survey_id,
-							   $quest_array[$i],
-							   $group_id));
-			} else {
-
 			$result2 = db_query_params ('SELECT avg(response::int) AS avg FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3 AND response IN (1,2,3,4,5)',
 						    array ($survey_id,
 							   $quest_array[$i],
 							   $group_id));
-			}
 			if (!$result2 || db_numrows($result2) < 1) {
 				echo _('error');
 				echo db_error();
@@ -183,22 +174,13 @@
 		}
 
 		// average
-	    if ( $sys_database_type == "mysql" ) {
 
-		    $result2 = db_query_params ('SELECT avg(response) AS avg FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3  and response != $4',
-						array ($survey_id,
-						       $quest_array[$i],
-						       $group_id,
-						       ''));
-		} else {
+		$result2 = db_query_params ('SELECT avg(response::int) AS avg FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3  and response != $4',
+					    array ($survey_id,
+						   $quest_array[$i],
+						   $group_id,
+						   ''));
 
-		    $result2 = db_query_params ('SELECT avg(response::int) AS avg FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3  and response != $4',
-						array ($survey_id,
-						       $quest_array[$i],
-						       $group_id,
-							''));
-		}
-
 		if (!$result2 || db_numrows($result2) < 1) {
 			echo _('error');
 			echo db_error();




More information about the Fusionforge-commits mailing list