[Fusionforge-commits] r9489 - in trunk/gforge: common/forum common/include common/pm common/reporting common/search common/tracker cronjobs etc etc/local.d plugins/webcalendar/www/includes www/admin www/frs/include www/include www/pm/msproject

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


Author: lolando
Date: 2010-04-14 21:41:53 +0200 (Wed, 14 Apr 2010)
New Revision: 9489

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/common/tracker/ArtifactFactory.class.php
   trunk/gforge/cronjobs/stats_projects.inc
   trunk/gforge/etc/local.d/10database.env
   trunk/gforge/etc/local.inc.example
   trunk/gforge/plugins/webcalendar/www/includes/config.php
   trunk/gforge/www/admin/pluginman.php
   trunk/gforge/www/frs/include/frs_utils.php
   trunk/gforge/www/include/pre.php
   trunk/gforge/www/include/squal_pre.php
   trunk/gforge/www/pm/msproject/msp.php
Log:
Removed logic for switching across databases (and the sys_database_type variable)

Modified: trunk/gforge/common/forum/Forum.class.php
===================================================================
--- trunk/gforge/common/forum/Forum.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/forum/Forum.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -211,8 +211,6 @@
 	 *	@return	boolean	success.
 	 */
 	function fetchData($group_forum_id) {
-		global $sys_database_type;
-
 		$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) {

Modified: trunk/gforge/common/forum/ForumFactory.class.php
===================================================================
--- trunk/gforge/common/forum/ForumFactory.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/forum/ForumFactory.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -78,8 +78,6 @@
 	 *	@return	array	The array of Forum objects.
 	 */
 	function &getForums() {
-		global $sys_database_type;
-
 		if ($this->forums) {
 			return $this->forums;
 		}
@@ -146,8 +144,6 @@
 	 *	@return	array	The array of Forum objects.
 	 */
 	function &getForumsAdmin() {
-		global $sys_database_type;
-
 		if ($this->forums) {
 			return $this->forums;
 		}

Modified: trunk/gforge/common/include/forms.php
===================================================================
--- trunk/gforge/common/include/forms.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/include/forms.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -30,8 +30,6 @@
  *
  */
 function form_generate_key() {
-	global $sys_database_type;
-
 	$is_new=false;
 	db_begin();
 	// there's about 99.999999999% probability this loop will run only once :) 
@@ -60,8 +58,6 @@
  *
  */
 function form_key_is_valid($key) {
-	global $sys_database_type;
-
 	// Fail back mode if key is empty. This can happen when there is
 	// a problem with the generation. In this case, it may be better
 	// to disable this check instead of blocking all the application.
@@ -91,8 +87,6 @@
  *
  */
 function form_release_key($key) {
-	global $sys_database_type;
-
 	db_begin();
 	$res = db_query_params ('SELECT * FROM form_keys WHERE key=$1 FOR UPDATE', array ($key));
 	if (!$res || !db_numrows($res)) {

Modified: trunk/gforge/common/pm/ProjectTask.class.php
===================================================================
--- trunk/gforge/common/pm/ProjectTask.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/pm/ProjectTask.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -137,8 +137,6 @@
 	 */
 	function create($summary,$details,$priority,$hours,$start_date,$end_date,
 			$category_id,$percent_complete,&$assigned_arr,&$depend_arr,$duration=0,$parent_id=0) {
-		global $sys_database_type;
-
 		$v = new Validator();
 		$v->check($summary, "summary");
 		$v->check($details, "details");

Modified: trunk/gforge/common/reporting/ReportSetup.class.php
===================================================================
--- trunk/gforge/common/reporting/ReportSetup.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/reporting/ReportSetup.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -41,8 +41,6 @@
 }
 
 function createTables() {
-	global $sys_database_type;
-
 //time tracking
 //DROP TABLE rep_time_category;
 	$sql[]="CREATE TABLE rep_time_category (
@@ -955,8 +953,6 @@
  *	@return	boolean	Success.
  */
 function user_act_daily($day) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_user_act_daily WHERE day=$1',
 			array($day)) ;
 
@@ -1061,8 +1057,6 @@
  *  @return boolean Success.
  */
 function user_act_weekly($week) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_user_act_weekly WHERE week=$1',
 			array($week)) ;
 
@@ -1109,8 +1103,6 @@
  *  @return boolean Success.
  */
 function user_act_monthly($month,$end) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_user_act_monthly WHERE month=$1',
 			array($month)) ;
 
@@ -1158,8 +1150,6 @@
  *	@return	boolean	Success.
  */
 function group_act_daily($day) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_group_act_daily WHERE day=$1',
 			array($day)) ;
 
@@ -1285,8 +1275,6 @@
  *  @return boolean Success.
  */
 function group_act_weekly($week) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_group_act_weekly WHERE week=$1',
 			array($week)) ;
 
@@ -1335,8 +1323,6 @@
  *  @return boolean Success.
  */
 function group_act_monthly($month,$end) {
-	global $sys_database_type;
-
 	db_query_params ('DELETE FROM rep_group_act_monthly WHERE month=$1',
 			array($month)) ;
 

Modified: trunk/gforge/common/reporting/report_utils.php
===================================================================
--- trunk/gforge/common/reporting/report_utils.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/reporting/report_utils.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -94,8 +94,6 @@
 }
 
 function report_useract_box($name='dev_id', $selected='1', $start_with='') {
-	global $sys_database_type;
-
 	if ($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',
@@ -109,8 +107,6 @@
 }
 
 function report_usertime_box($name='dev_id', $selected='1', $start_with='') {
-	global $sys_database_type;
-
 	if ($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',

Modified: trunk/gforge/common/search/ArtifactSearchQuery.class.php
===================================================================
--- trunk/gforge/common/search/ArtifactSearchQuery.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/search/ArtifactSearchQuery.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -64,7 +64,6 @@
 	 * @return array query+params array
 	 */
 	function getQuery() {
-		global $sys_database_type;
 		global $sys_use_fti;
 
 		$qpa = db_construct_qpa () ;
@@ -158,8 +157,6 @@
 	 * @return array query+params array
 	 */	
 	function getSearchByIdQuery() {
-		global $sys_database_type;
-
 		$qpa = db_construct_qpa () ;
 
 		$qpa = db_construct_qpa ($qpa,

Modified: trunk/gforge/common/tracker/ArtifactFactory.class.php
===================================================================
--- trunk/gforge/common/tracker/ArtifactFactory.class.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/common/tracker/ArtifactFactory.class.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -286,8 +286,6 @@
 	 *	@return	array	The array of Artifact objects.
 	 */
 	function &getArtifacts() {
-		global $sys_database_type;
-
 		if (!empty($this->artifacts)) {
 			return $this->artifacts;
 		}

Modified: trunk/gforge/cronjobs/stats_projects.inc
===================================================================
--- trunk/gforge/cronjobs/stats_projects.inc	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/cronjobs/stats_projects.inc	2010-04-14 19:41:53 UTC (rev 9489)
@@ -26,8 +26,6 @@
 //
 
 function project_stats_day($year,$month,$day) {
-	global $sys_database_type;
-
 	db_begin();
 
 	$day_begin=mktime(0,0,0,$month,$day,$year);
@@ -39,242 +37,8 @@
 			 array ("$year$month",
 				$day));
 
-	if ($sys_database_type == "mysql") {
-		db_query_mysql ("INSERT INTO stats_project
+	db_query_params ('INSERT INTO stats_project
 SELECT
-'$year$month' AS month,
-'$day' AS day,
-mess.* FROM (
-SELECT
-	groups.group_id,
-	r.count AS release_count,
-	fmcount.count AS msg_posted,
-	fucount.count AS msg_uniq_auth,
-	obug.count AS bugs_opened,
-	cbug.count AS bugs_closed,
-	osupport.count AS support_opened,
-	csupport.count AS support_closed,
-	opatches.count AS patches_opened,
-	cpatches.count AS patches_closed,
-	oartifact.count AS artifacts_opened,
-	cartifact.count AS artifacts_closed,
-	otask.count AS tasks_opened,
-	ctask.count AS tasks_closed,
-	helpr.count AS help_requests
-
-FROM groups
-
---
---	Create tmp table of groups that made any releases
---
-LEFT JOIN (
-	SELECT group_id,COUNT(release_id) AS count
-	FROM frs_release,frs_package
-	WHERE
-		frs_release.release_date > '$day_begin'
-		AND frs_release.release_date < '$day_end'
-		AND frs_release.package_id = frs_package.package_id
-	GROUP BY group_id
-	) r USING (group_id)
-
---
---	Create tmp table of groups that had any forum posts
---
-LEFT JOIN (
-	SELECT forum_group_list.group_id,COUNT(forum.msg_id) AS count
-	FROM forum_group_list, forum
-	WHERE
-		forum_group_list.group_forum_id = forum.group_forum_id
-		AND forum.post_date > '$day_begin'
-		AND forum.post_date < '$day_end'
-	GROUP BY forum_group_list.group_id
-	) fmcount USING (group_id)
-
---
---	Create tmp table of groups and unique posters to forums
---
-LEFT JOIN (
-	SELECT forum_group_list.group_id,COUNT( DISTINCT(forum.posted_by) ) AS count
-	FROM forum_group_list, forum
-	WHERE
-		forum_group_list.group_forum_id = forum.group_forum_id
-		AND forum.post_date > '$day_begin'
-		AND forum.post_date < '$day_end'
-	GROUP BY group_id
-	) fucount USING (group_id)
-
---
---	Create tmp table of groups and opened bugs
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.open_date > '$day_begin'
-		AND a.open_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='1'
-	GROUP BY agl.group_id
-	) obug USING (group_id)
-
---
---	Create tmp table of groups and closed bugs
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.close_date > '$day_begin'
-		AND a.close_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='1'
-	GROUP BY agl.group_id
-	) cbug USING (group_id)
-
---
---	Create tmp table of groups and opened support
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.open_date > '$day_begin'
-		AND a.open_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='2'
-	GROUP BY agl.group_id
-	) osupport USING (group_id)
-
---
---	Create tmp table of groups and closed support
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.close_date > '$day_begin'
-		AND a.close_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='2'
-	GROUP BY agl.group_id
-	) csupport USING (group_id)
-
---
---	Create tmp table of groups and opened patches
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.open_date > '$day_begin'
-		AND a.open_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='3'
-	GROUP BY agl.group_id
-	) opatches USING (group_id)
-
---
---	Create tmp table of groups and closed patches
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.close_date > '$day_begin'
-		AND a.close_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-		AND agl.datatype='3'
-	GROUP BY agl.group_id
-	) cpatches USING (group_id)
-
---
---	Create tmp table of groups and opened total artifacts
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.open_date > '$day_begin'
-		AND a.open_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-	GROUP BY agl.group_id
-	) oartifact USING (group_id)
-
---
---	Create tmp table of groups and closed total artifacts
---
-LEFT JOIN (
-	SELECT agl.group_id,count(*) AS count
-	FROM artifact_group_list agl,artifact a
-	WHERE
-		a.close_date > '$day_begin'
-		AND a.close_date < '$day_end'
-		AND a.group_artifact_id=agl.group_artifact_id
-	GROUP BY agl.group_id
-	) cartifact USING (group_id)
-
---
---	Create tmp table of groups that opened tasks
---
-LEFT JOIN (
-	SELECT pgl.group_id,count(pt.project_task_id) AS count
-	FROM project_group_list pgl, project_task pt
-	WHERE
-		pgl.group_project_id=pt.group_project_id
-		AND pt.start_date > '$day_begin'
-		AND pt.start_date < '$day_end'
-	GROUP BY pgl.group_id
-	) otask USING (group_id)
-
---
---	Create tmp table of groups that closed tasks
---
-LEFT JOIN (
-	SELECT pgl.group_id,count(pt.project_task_id) AS count
-	FROM project_group_list pgl, project_task pt
-	WHERE
-		pgl.group_project_id=pt.group_project_id
-		AND pt.end_date > '$day_begin'
-		AND pt.end_date < '$day_end'
-	GROUP BY pgl.group_id
-	) ctask USING (group_id)
-
---
---	Create tmp table of groups that closed tasks
---
-LEFT JOIN (
-	SELECT group_id,COUNT(job_id) AS count
-	FROM people_job
-	WHERE
-		post_date > '$day_begin'
-		AND post_date < '$day_end'
-	GROUP BY group_id
-	) helpr USING (group_id)
-
-) mess
-
---
---	We really only want the rows that have any content
---
-WHERE
-release_count > 0
-OR msg_posted > 0
-OR msg_uniq_auth > 0
-OR bugs_opened > 0
-OR bugs_closed > 0
-OR support_opened > 0
-OR support_closed > 0
-OR patches_opened > 0
-OR patches_closed > 0
-OR artifacts_opened > 0
-OR artifacts_closed > 0
-OR tasks_opened > 0
-OR tasks_closed > 0
-OR help_requests > 0;");
-	} else {
-
-		db_query_params ('INSERT INTO stats_project
-SELECT
 $1::int AS month,
 $2::int AS day,
 * FROM (
@@ -504,22 +268,21 @@
 OR tasks_opened > 0
 OR tasks_closed > 0
 OR help_requests > 0;',
-			array($year.$month,
-			      $day,
-			      $day_begin,
-			      $day_end,
-			      '1',
-			      '1',
-			      '2',
-			      '2',
-			      '3',
-			      '3'));
-
+			 array($year.$month,
+			       $day,
+			       $day_begin,
+			       $day_end,
+			       '1',
+			       '1',
+			       '2',
+			       '2',
+			       '3',
+			       '3'));
+	
 		echo db_error();
-
+		
 		db_commit();
-	}
-}
+  }
 
 // Local Variables:
 // mode: php

Modified: trunk/gforge/etc/local.d/10database.env
===================================================================
--- trunk/gforge/etc/local.d/10database.env	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/etc/local.d/10database.env	2010-04-14 19:41:53 UTC (rev 9489)
@@ -1,5 +1,3 @@
-$sys_database_type='pgsql';
-
 if (function_exists ('apache_request_headers')) {
 	$headers = apache_request_headers() ;
 }

Modified: trunk/gforge/etc/local.inc.example
===================================================================
--- trunk/gforge/etc/local.inc.example	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/etc/local.inc.example	2010-04-14 19:41:53 UTC (rev 9489)
@@ -11,12 +11,6 @@
 $sys_var_path='/var/lib/gforge';
 
 //
-// FusionForge database type
-//
-//$sys_database_type='mysql';
-$sys_database_type='pgsql';
-
-//
 // FusionForge hostnames
 //
 // Hostnames should be fully qualified domain names (FQDNs); using short names

Modified: trunk/gforge/plugins/webcalendar/www/includes/config.php
===================================================================
--- trunk/gforge/plugins/webcalendar/www/includes/config.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/plugins/webcalendar/www/includes/config.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -77,7 +77,7 @@
   exit;
 }
 
-global $sys_database_type,$sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname;
+global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname;
 
 $db_type = 'postgresql';
 $settings['db_type'] = 'postgresql';

Modified: trunk/gforge/www/admin/pluginman.php
===================================================================
--- trunk/gforge/www/admin/pluginman.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/www/admin/pluginman.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -147,7 +147,7 @@
 
 			if (getStringFromRequest('init')) {
 				// now we're going to check if there's a XX-init.sql file and run it
-				$db_init = $sys_plugins_path . '/' . $pluginname . '/db/' . $pluginname . '-init-'. $sys_database_type .'.sql';
+				$db_init = $sys_plugins_path . '/' . $pluginname . '/db/' . $pluginname . '-init-pgsql.sql';
 				if (!is_file($db_init)) {
 					$db_init = $sys_plugins_path . '/' . $pluginname . '/db/' . $pluginname . '-init.sql';
 					if (!is_file($db_init)) {

Modified: trunk/gforge/www/frs/include/frs_utils.php
===================================================================
--- trunk/gforge/www/frs/include/frs_utils.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/www/frs/include/frs_utils.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -180,7 +180,7 @@
 	/*
 		return a pop-up select box of releases for the project
 	*/
-	global $FRS_RELEASE_RES, $sys_database_type;
+	global $FRS_RELEASE_RES;
 
 	if (!$group_id) {
 		return 'ERROR - GROUP ID REQUIRED';

Modified: trunk/gforge/www/include/pre.php
===================================================================
--- trunk/gforge/www/include/pre.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/www/include/pre.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -70,7 +70,7 @@
 require_once $gfcommon.'include/utils.php';
 
 //database abstraction
-require_once $gfcommon.'include/database-'.$sys_database_type.'.php';
+require_once $gfcommon.'include/database-pgsql.php';
 
 //security library
 require_once $gfcommon.'include/session.php';

Modified: trunk/gforge/www/include/squal_pre.php
===================================================================
--- trunk/gforge/www/include/squal_pre.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/www/include/squal_pre.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -21,7 +21,7 @@
 
 require $gfcgfile;
 require $gfcommon.'include/constants.php';
-require_once $gfcommon.'include/database-'.$sys_database_type.'.php';
+require_once $gfcommon.'include/database-pgsql.php';
 require_once $gfcommon.'include/session.php';
 require_once $gfcommon.'include/Error.class.php';
 require_once $gfcommon.'include/User.class.php';

Modified: trunk/gforge/www/pm/msproject/msp.php
===================================================================
--- trunk/gforge/www/pm/msproject/msp.php	2010-04-14 19:33:14 UTC (rev 9488)
+++ trunk/gforge/www/pm/msproject/msp.php	2010-04-14 19:41:53 UTC (rev 9489)
@@ -31,7 +31,7 @@
 	$array[errormessage]='Bad Password';
  */
 function &MSPLogin($username,$password) {
-	global $feedback,$session_ser,$sys_database_type;
+	global $feedback,$session_ser;
 
 	$success=session_login_valid(strtolower($username),$password);
 	if ($success) {




More information about the Fusionforge-commits mailing list