[Fusionforge-commits] r11689 - trunk/src/common/docman/engine

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Thu Dec 2 17:52:01 CET 2010


Author: nerville
Date: 2010-12-02 17:52:00 +0100 (Thu, 02 Dec 2010)
New Revision: 11689

Modified:
   trunk/src/common/docman/engine/parser_doc.php
   trunk/src/common/docman/engine/parser_html.php
   trunk/src/common/docman/engine/parser_oo.php
   trunk/src/common/docman/engine/parser_pdf.php
Log:
use forge_get_config data_path when needed : no more hardcoded tmp dir

Modified: trunk/src/common/docman/engine/parser_doc.php
===================================================================
--- trunk/src/common/docman/engine/parser_doc.php	2010-12-02 16:51:06 UTC (rev 11688)
+++ trunk/src/common/docman/engine/parser_doc.php	2010-12-02 16:52:00 UTC (rev 11689)
@@ -38,7 +38,7 @@
 if (!is_file($fichin))
 	exit (1);
 
-$fichout = "/tmp/gfo".rand(10000, 99999).".tmp";
+$fichout = tempnam(forge_get_config('data_path'), "tmp");
 $cmd = "/usr/bin/antiword -i1 -t $fichin > $fichout";
 $res = shell_exec($cmd);
 

Modified: trunk/src/common/docman/engine/parser_html.php
===================================================================
--- trunk/src/common/docman/engine/parser_html.php	2010-12-02 16:51:06 UTC (rev 11688)
+++ trunk/src/common/docman/engine/parser_html.php	2010-12-02 16:52:00 UTC (rev 11689)
@@ -43,7 +43,7 @@
 fclose($fd);
 
 $strip_content = strip_tags($contents);
-$filename = tempnam("/tmp", "tmp");
+$filename = tempnam(forge_get_config('data_path'), "tmp");
 $fd = fopen($filename, "w");
 fwrite($fd , $strip_content);
 fclose($fd);

Modified: trunk/src/common/docman/engine/parser_oo.php
===================================================================
--- trunk/src/common/docman/engine/parser_oo.php	2010-12-02 16:51:06 UTC (rev 11688)
+++ trunk/src/common/docman/engine/parser_oo.php	2010-12-02 16:52:00 UTC (rev 11689)
@@ -31,21 +31,21 @@
 
 if ($argc != 2) {
 	echo "Usage : parser_oo.php <filename>\n";
-	exit (1);
+	exit(1);
 }
 
 $fichin = $argv[1];
 if (!is_file($fichin))
-	exit (1);
+	exit(1);
 
 $zip = new ZipArchive;
 if ($zip->open($fichin) === TRUE) {
-	$output_dir = $fichin.".dir";
+	$output_dir = tempnam(forge_get_config('data_path'), "tmp");
 	mkdir($output_dir);
 	$zip->extractTo($output_dir, array('content.xml'));
 	$zip->close();
 } else {
-	exit (2);
+	exit(2);
 }
 
 // transformer le context.xml en fichier txt

Modified: trunk/src/common/docman/engine/parser_pdf.php
===================================================================
--- trunk/src/common/docman/engine/parser_pdf.php	2010-12-02 16:51:06 UTC (rev 11688)
+++ trunk/src/common/docman/engine/parser_pdf.php	2010-12-02 16:52:00 UTC (rev 11689)
@@ -39,7 +39,7 @@
 if (!is_file($fichin))
 	exit (1);
 
-$fichout = tempnam("/tmp","tmp");
+$fichout = tempnam(forge_get_config('data_path'),"tmp");
 $cmd = "/usr/bin/pdftotext $fichin $fichout";
 $res = shell_exec($cmd);
 




More information about the Fusionforge-commits mailing list