Author: gimler
Date: 2010-02-10 13:18:45 +0100 (Wed, 10 Feb 2010)
New Revision: 27813

Modified:
   
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
   
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/lib/dmDoctrineGraphviz.php
Log:
[Diem] fix diagram generation use tempnam, remove temp file and fix exception 
message

Modified: 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
  2010-02-10 11:29:36 UTC (rev 27812)
+++ 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
  2010-02-10 12:18:45 UTC (rev 27813)
@@ -51,7 +51,7 @@
     
     $dependencyDiagramImageFullPath = dmOs::join(sfConfig::get('sf_web_dir'), 
'cache', $dependencyDiagramImage);
     
-    $dotFile = dmOs::join(sys_get_temp_dir(), dmString::random(12).'.dot');
+    $dotFile = tempnam(sys_get_temp_dir(), 'dm_dependency_');
     
     if 
(!$this->context->getFilesystem()->mkdir(dirname($dependencyDiagramImageFullPath)))
     {
@@ -112,7 +112,9 @@
     //$return = $filesystem->exec(sprintf('twopi -Granksep=5 -Tpng %s > %s', 
$dotFile, $dependencyDiagramImageFullPath));
 
     $return = $filesystem->exec(sprintf('neato -Tpng %s > %s', $dotFile, 
$dependencyDiagramImageFullPath));
-    
+
+    unlink($dotFile);
+
     if (!$return)
     {
       $this->getUser()->logError(sprintf('Diem can not generate the %s 
dependency diagram. Probably graphviz is not installed on the server.', 
$appName), false);

Modified: 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/lib/dmDoctrineGraphviz.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/lib/dmDoctrineGraphviz.php
 2010-02-10 11:29:36 UTC (rev 27812)
+++ 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/lib/dmDoctrineGraphviz.php
 2010-02-10 12:18:45 UTC (rev 27813)
@@ -30,7 +30,7 @@
 
     $imageFullPath = dmOs::join(sfConfig::get('sf_web_dir'), 'cache', 
$diagramImage);
 
-    $dotFile = dmOs::join(sys_get_temp_dir(), dmString::random(12).'.dot');
+    $dotFile = tempnam(sys_get_temp_dir(), 'dm_mld_');
 
     if (!$this->filesystem->mkdir(dirname($imageFullPath)))
     {
@@ -41,9 +41,11 @@
 
     $return = $this->filesystem->exec(sprintf('dot -Tpng %s > %s', $dotFile, 
$imageFullPath));
 
+    unlink($dotFile);
+
     if (!$return)
     {
-      throw new dmException(sprintf('Diem can not generate the mcd diagram : 
%s', $this->filesystem->getLastExec('output')));
+      throw new dmException(sprintf('Diem can not generate the mld diagram : 
%s', $this->filesystem->getLastExec('output')));
     }
     
     return '/cache/'.$diagramImage;

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to