[Fusionforge-commits] r10383 - in trunk/src/common: dao/include docman frs mail pm tracker

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Wed Sep 1 18:38:21 CEST 2010


Author: aljeux
Date: 2010-09-01 18:38:20 +0200 (Wed, 01 Sep 2010)
New Revision: 10383

Modified:
   trunk/src/common/dao/include/DataAccessObject.class.php
   trunk/src/common/docman/Document.class.php
   trunk/src/common/frs/FRSFile.class.php
   trunk/src/common/frs/FRSPackage.class.php
   trunk/src/common/frs/FRSRelease.class.php
   trunk/src/common/mail/MailingList.class.php
   trunk/src/common/pm/ProjectCategory.class.php
   trunk/src/common/pm/ProjectTask.class.php
   trunk/src/common/pm/ProjectTasksForUser.class.php
   trunk/src/common/tracker/Artifact.class.php
   trunk/src/common/tracker/ArtifactBoxOptions.class.php
   trunk/src/common/tracker/ArtifactCanned.class.php
   trunk/src/common/tracker/ArtifactExtraField.class.php
   trunk/src/common/tracker/ArtifactExtraFieldElement.class.php
   trunk/src/common/tracker/ArtifactFile.class.php
   trunk/src/common/tracker/ArtifactFromID.class.php
   trunk/src/common/tracker/ArtifactHistory.class.php
Log:
Fix php warnings mostly
Move db_rollback() after reading db_error() to get the error message.

Modified: trunk/src/common/dao/include/DataAccessObject.class.php
===================================================================
--- trunk/src/common/dao/include/DataAccessObject.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/dao/include/DataAccessObject.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -24,7 +24,7 @@
     * @return mixed either false if error or object DataAccessResult
     */
     function &retrieve($sql,$params) {
-        $result =& new DataAccessResult(db_query_params($sql,$params));
+        $result = new DataAccessResult(db_query_params($sql,$params));
         
         return $result;
     }

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/docman/Document.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -192,7 +192,7 @@
 			$this->setError(_('Document:: Invalid docid'));
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/frs/FRSFile.class.php
===================================================================
--- trunk/src/common/frs/FRSFile.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/frs/FRSFile.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -181,8 +181,8 @@
 						  $file_size,
 						  time ())) ;
 		if (!$result) {
+			$this->setError('FRSFile::create() Error Adding Release: '.db_error());
 			db_rollback();
-			$this->setError('FRSFile::create() Error Adding Release: '.db_error());
 			return false;
 		}
 		$this->file_id=db_insertid($result,'frs_file','file_id');
@@ -208,7 +208,7 @@
 			$this->setError('FRSFile::fetchData()  Invalid file_id');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}
@@ -404,15 +404,15 @@
 				$FRSRelease->getFileName().'/'.
 				$this->data_array['filename'];
 			if (file_exists($new_file_location)) {
+				$this->setError(_('That filename already exists in this project space'));
 				db_rollback();
-				$this->setError(_('That filename already exists in this project space'));
 				return false;
 			}
 			$cmd="/bin/mv $old_file_location $new_file_location";
 			exec($cmd,$out);
 			if (!file_exists($new_file_location)) {
+				$this->setError(_('File cannot be moved to the permanent location').': '.$new_file_location);
 				db_rollback();
-				$this->setError(_('File cannot be moved to the permanent location').': '.$new_file_location);
 				return false;
 			}
 		}

Modified: trunk/src/common/frs/FRSPackage.class.php
===================================================================
--- trunk/src/common/frs/FRSPackage.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/frs/FRSPackage.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -58,7 +58,7 @@
 				$FRSPACKAGE_OBJ['_'.$package_id.'_']=false;
 				return false;
 			}
-			$data =& db_fetch_array($res);			
+			$data = db_fetch_array($res);			
 		}
 		$Group =& group_get_object($data['group_id']);
 		$FRSPACKAGE_OBJ['_'.$package_id.'_']= new FRSPackage($Group,$data['package_id'],$data);
@@ -159,8 +159,8 @@
 						  1,
 						  $is_public)) ;
 		if (!$result) {
+			$this->setError('FRSPackage::create() Error Adding Package: '.db_error());
 			db_rollback();
-			$this->setError('FRSPackage::create() Error Adding Package: '.db_error());
 			return false;
 		}
 		$this->package_id=db_insertid($result,'frs_package','package_id');
@@ -388,15 +388,15 @@
 					       $this->Group->getID(),
 					       $this->getID())) ;
 		if (!$res || db_affected_rows($res) < 1) {
+			$this->setError('FRSPackage::update() Error On Update: '.db_error());
 			db_rollback();
-			$this->setError('FRSPackage::update() Error On Update: '.db_error());
 			return false;
 		}
 
 		$olddirname = $this->getFileName();
 		if(!$this->fetchData($this->getID())){
+			$this->setError("FRSPackage::update() Error Updating Package: Couldn't fetch data");
 			db_rollback();
-			$this->setError("FRSPackage::update() Error Updating Package: Couldn't fetch data");
 			return false;
 		}
 		$newdirname = $this->getFileName();
@@ -405,13 +405,13 @@
 		
 		if(($olddirname!=$newdirname)){
 			if(is_dir($newdirlocation)){
+				$this->setError('FRSPackage::update() Error Updating Package: Directory Already Exists');
 				db_rollback();
-				$this->setError('FRSPackage::update() Error Updating Package: Directory Already Exists');
 				return false;	
 			} else {
 				if(!@rename($olddirlocation,$newdirlocation)) {
+					$this->setError("FRSPackage::update() Error Updating Package: Couldn't rename dir");
 					db_rollback();
-					$this->setError("FRSPackage::update() Error Updating Package: Couldn't rename dir");
 					return false;
 				}
 			}

Modified: trunk/src/common/frs/FRSRelease.class.php
===================================================================
--- trunk/src/common/frs/FRSRelease.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/frs/FRSRelease.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -45,7 +45,7 @@
 				$FRSRELEASE_OBJ['_'.$release_id.'_']=false;
 				return false;
 			}
-			$data =& db_fetch_array($res);
+			$data = db_fetch_array($res);
 		}
 		$FRSPackage =& frspackage_get_object($data['package_id']);
 		$FRSRELEASE_OBJ['_'.$release_id.'_']= new FRSRelease($FRSPackage,$data['release_id'],$data);
@@ -156,8 +156,8 @@
 						user_getid(),
 						1)) ;
 		if (!$result) {
+			$this->setError('FRSRelease::create() Error Adding Release: '.db_error());
 			db_rollback();
-			$this->setError('FRSRelease::create() Error Adding Release: '.db_error());
 			return false;
 		}
 		$this->release_id=db_insertid($result,'frs_release','release_id');
@@ -188,7 +188,7 @@
 			$this->setError('FRSRelease::fetchData()  Invalid release_id');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}
@@ -439,15 +439,15 @@
 					       $this->getID())) ;
 
 		if (!$res || db_affected_rows($res) < 1) {
+			$this->setError('FRSRelease::update() Error On Update: '.db_error());
 			db_rollback();
-			$this->setError('FRSRelease::update() Error On Update: '.db_error());
 			return false;
 		}
 
 		$oldfilename = $this->getFileName();
 		if(!$this->fetchData($this->getID())){
+			$this->setError("FRSRelease::update() Error Updating Release: Couldn't fetch data");
 			db_rollback();
-			$this->setError("FRSRelease::update() Error Updating Release: Couldn't fetch data");
 			return false;
 		}
 		$newfilename = $this->getFileName();
@@ -456,13 +456,13 @@
 	
 		if (($oldfilename!=$newfilename) && is_dir($olddirlocation)) {
 			if (is_dir($newdirlocation)) {
+				$this->setError('FRSRelease::update() Error Updating Release: Directory Already Exists');
 				db_rollback();
-				$this->setError('FRSRelease::update() Error Updating Release: Directory Already Exists');
 				return false;	
 			} else {
 				if(!rename($olddirlocation,$newdirlocation)) {
+					$this->setError("FRSRelease::update() Error Updating Release: Couldn't rename dir");
 					db_rollback();
-					$this->setError("FRSRelease::update() Error Updating Release: Couldn't rename dir");
 					return false;
 				}
 			}

Modified: trunk/src/common/mail/MailingList.class.php
===================================================================
--- trunk/src/common/mail/MailingList.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/mail/MailingList.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -161,8 +161,8 @@
 						  $description)) ;
 		
 		if (!$result) {
+			$this->setError(sprintf(_('Error Creating %1$s'), _('Error Creating %1$s')).db_error());
 			db_rollback();
-			$this->setError(sprintf(_('Error Creating %1$s'), _('Error Creating %1$s')).db_error());
 			return false;
 		}
 			
@@ -217,7 +217,7 @@
 			$this->setError(sprintf(_('Error Getting %1$s'), _('Error Getting %1$s')));
 			return false;
 		}
-		$this->dataArray =& db_fetch_array($res);
+		$this->dataArray = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/pm/ProjectCategory.class.php
===================================================================
--- trunk/src/common/pm/ProjectCategory.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/pm/ProjectCategory.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -135,7 +135,7 @@
 			$this->setError('ProjectCategory: Invalid ProjectCategory ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/pm/ProjectTask.class.php
===================================================================
--- trunk/src/common/pm/ProjectTask.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/pm/ProjectTask.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -40,7 +40,7 @@
 					$PROJECTTASK_OBJ["_".$project_task_id."_"]=false;
 					return false;
 				}
-				$data =& db_fetch_array($res);
+				$data = db_fetch_array($res);
 
 			}
 			$ProjectGroup =& projectgroup_get_object($data["group_project_id"]);
@@ -226,7 +226,7 @@
 			$this->setError('ProjectTask::fetchData() Invalid Task ID'.db_error());
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/pm/ProjectTasksForUser.class.php
===================================================================
--- trunk/src/common/pm/ProjectTasksForUser.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/pm/ProjectTasksForUser.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -61,7 +61,7 @@
 		$rows=db_numrows($result);
 		for ($i=0; $i < $rows; $i++) {
 			$project_task_id = db_result($result,$i,'project_task_id');
-			$arr =& db_fetch_array($result);
+			$arr = db_fetch_array($result);
 			$task =& projecttask_get_object($project_task_id,$arr);
 			$tasks[] =& $task;
 		}

Modified: trunk/src/common/tracker/Artifact.class.php
===================================================================
--- trunk/src/common/tracker/Artifact.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/Artifact.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -75,7 +75,7 @@
 					$ARTIFACT_OBJ["_".$artifact_id."_"]=false;
 					return false;
 				}
-				$data =& db_fetch_array($res);
+				$data = db_fetch_array($res);
 			}
 			$ArtifactType =& artifactType_get_object($data["group_artifact_id"]);
 			$ARTIFACT_OBJ["_".$artifact_id."_"]= new Artifact($ArtifactType,$data);
@@ -319,7 +319,7 @@
 			$this->setError('Artifact: Invalid ArtifactID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/tracker/ArtifactBoxOptions.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactBoxOptions.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactBoxOptions.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -134,7 +134,7 @@
 			$this->setError('ArtifactSelectionBox: Invalid Artifact ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/tracker/ArtifactCanned.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactCanned.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactCanned.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -133,7 +133,7 @@
 			$this->setError('ArtifactCanned: Invalid ArtifactCanned ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/tracker/ArtifactExtraField.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactExtraField.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactExtraField.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -234,7 +234,7 @@
 			$this->setError('ArtifactExtraField: Invalid ArtifactExtraField ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}
@@ -317,7 +317,7 @@
 	 *
 	 *	@return	array	types.
 	 */
-	function getAvailableTypes() {
+	static function getAvailableTypes() {
 		return array(
 			1=>_('Select Box'),
 			2=>_('Check Box'),

Modified: trunk/src/common/tracker/ArtifactExtraFieldElement.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactExtraFieldElement.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactExtraFieldElement.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -183,7 +183,7 @@
 			$this->setError('ArtifactExtraField: Invalid ArtifactExtraFieldElement ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}

Modified: trunk/src/common/tracker/ArtifactFile.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactFile.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactFile.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -44,7 +44,7 @@
 				$ARTIFACTFILE_OBJ["_".$artifact_file_id."_"]=false;
 				return false;
 			}
-			$data =& db_fetch_array($res);
+			$data = db_fetch_array($res);
 		}
 		$Artifact =& artifact_get_object($data["artifact_id"]);
 		$ARTIFACTFILE_OBJ["_".$artifact_file_id."_"]= new ArtifactFile($Artifact,$data);

Modified: trunk/src/common/tracker/ArtifactFromID.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactFromID.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactFromID.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -41,7 +41,7 @@
 				$this->setError("Invalid Artifact ID");
 				return false;
 			} else {
-				$art_arr =& db_fetch_array($res);
+				$art_arr = db_fetch_array($res);
 			}
 		} 
 

Modified: trunk/src/common/tracker/ArtifactHistory.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactHistory.class.php	2010-09-01 15:57:18 UTC (rev 10382)
+++ trunk/src/common/tracker/ArtifactHistory.class.php	2010-09-01 16:38:20 UTC (rev 10383)
@@ -130,7 +130,7 @@
 			$this->setError('ArtifactHistory: Invalid ArtifactHistory ID');
 			return false;
 		}
-		$this->data_array =& db_fetch_array($res);
+		$this->data_array = db_fetch_array($res);
 		db_free_result($res);
 		return true;
 	}




More information about the Fusionforge-commits mailing list