[Fusionforge-commits] FusionForge branch master updated. 0008d8c43afa54c328edbe71a4d7fafcc3387642

Alain Peyrat aljeux at fusionforge.org
Wed Nov 27 11:10:50 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  0008d8c43afa54c328edbe71a4d7fafcc3387642 (commit)
      from  831784b39bdeecb51c929ea5f9567745b1775b25 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0008d8c43afa54c328edbe71a4d7fafcc3387642
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Wed Nov 27 11:10:27 2013 +0100

    Docman: avoid storing document in memory to handle larger document

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index a66b48c..cd96b63 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -437,7 +437,16 @@ class Document extends Error {
 		if ($download)
 			$this->downloadUp();
 
-		return file_get_contents(DocumentStorage::instance()->get($this->getID()));
+		return file_get_contents($this->getFilePath());
+	}
+
+	/**
+	 * getFilePath - the filepath of this document.
+	 *
+	 * @return	string	The file where the file is stored.
+	 */
+	function getFilePath() {
+		return DocumentStorage::instance()->get($this->getID());
 	}
 
 	/**
diff --git a/src/www/docman/view.php b/src/www/docman/view.php
index aa628eb..6ce1997 100644
--- a/src/www/docman/view.php
+++ b/src/www/docman/view.php
@@ -89,7 +89,12 @@ if (is_numeric($docid)) {
 	header("Content-type: ".$d->getFileType());
 	header("Content-Transfer-Encoding: binary");
 	ob_end_clean();
-	echo $d->getFileData();
+
+	$file_path = $d->getFilePath();
+	$length = filesize($file_path);
+	header("Content-length: $length");
+
+	readfile_chunked($file_path);
 
 } elseif ($docid === 'backup') {
 	if (extension_loaded('zip')) {

-----------------------------------------------------------------------

Summary of changes:
 src/common/docman/Document.class.php |   11 ++++++++++-
 src/www/docman/view.php              |    7 ++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list