[Fusionforge-commits] r11892 - trunk/src/common/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Thu Dec 23 20:16:01 CET 2010


Author: nerville
Date: 2010-12-23 20:16:01 +0100 (Thu, 23 Dec 2010)
New Revision: 11892

Modified:
   trunk/src/common/docman/DocumentFactory.class.php
Log:
more storage API aware

Modified: trunk/src/common/docman/DocumentFactory.class.php
===================================================================
--- trunk/src/common/docman/DocumentFactory.class.php	2010-12-23 11:07:00 UTC (rev 11891)
+++ trunk/src/common/docman/DocumentFactory.class.php	2010-12-23 19:16:01 UTC (rev 11892)
@@ -5,6 +5,7 @@
  * Copyright 2000, Quentin Cregan/Sourceforge
  * Copyright 2002-2003, Tim Perdue/GForge, LLC
  * Copyright 2009, Roland Mas
+ * Copyright 2010, Franck Villaume - Capgemini
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -103,7 +104,7 @@
 	 */
 	function &getDocuments() {
 		if (!$this->Documents) {
-			$this->getFromDB();
+			$this->getFromStorage();
 		}
 
 		$return = array();
@@ -164,6 +165,23 @@
 	}
 
 	/**
+	 * getFromStorage - Retrieve documents from storage API
+	 *
+	 * @access	public
+	 */
+	function getFromStorage() {
+		switch ($this->Group->getStorageAPI()) {
+			case 'DB': {
+				$this->getFromDB();
+				break;
+			}
+			default: {
+				exit_error(_('StorageAPI unknown'), 'docman');
+			}
+		}
+	}
+
+	/**
 	 * getFromDB - Retrieve documents from database.
 	 *
 	 * @param	int	limit of documents return: default: 0 meaning : no limits
@@ -197,7 +215,7 @@
 
 		$result = db_query_qpa($qpa);
 		if (!$result) {
-			exit_error(print_r($qpa).':'.db_error(), 'docman');
+			exit_error(db_error(), 'docman');
 		}
 
 		while ($arr = db_fetch_array($result)) {




More information about the Fusionforge-commits mailing list