Extension talk:UML

From MediaWiki.org
Jump to: navigation, search

This looks very interesting indeed; is there any wiki where I could see this extension in action?

Contents

[edit] Sequence Diagrams

First off, I love this extension, and the manner in which it has been implemented is fantastic. Gotta love not rendering the image every time the page is viewed. One thing my manager noticed was that MetaUML doesn't do sequence diagrams. I found another product that does, UMLGraph, and decided to write a modification of the UML extension to use it. Hope this helps everyone. This works by just including the sequence formula in a <sequence> tag.. same way as the UML extension does it.

<?php
/**
 * Parser hook extension adds a <sequence> tag to wiki markup for rendering UML sequence
 * diagrams within a wiki page using UMLGraph's extension to pic2plot.
 *
 * Parameters:
 *   density=width       passed to ImageMagic to set resolution of the image in DPI.
 *   redraw              force diagram to be redrawn by deleting cached image.
 **/

// Make sure we are being called properly
if( !defined( 'MEDIAWIKI' ) ) {
  echo(" This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
  die( -1 );
}

$wgExtensionFunctions[] = "wfUMLGraphExtension";

$image_format = "png";
$tmp_filename = md5(rand());
$p2p_path   = "/usr/bin/pic2plot";
$sequence_path = "/usr/local/lib/sequence.pic"; #This comes from the UMLGraph library, install it anywhere.. 
$density      = "100%";
$redraw       = false;

function wfUMLGraphExtension() {
  global $wgParser;
    # register the extension with the WikiText parser
    # the first parameter is the name of the new tag.
    # In this case it defines the tag <sequence> ... </sequence>
    # the second parameter is the callback function for
    # processing the text between the tags
  $wgParser->setHook( "sequence", "renderSEQ" );
}

/**
 * wraps a minimalistic pic2plot document around the formula and returns a string
 * containing the whole document as string.
 *
 * @param string model in pic2plot's sequence diagram format
 * @returns string containing the given model, and the required header and footer.
 */
function wrap_sequence($pic2plot_source) {
global $sequence_path;
  $string  = ".PS\n";
  $string .= "copy \"";
  $string .= $sequence_path;
  $string .= "\";\n\n";
  $string .= "$pic2plot_source\n";
  $string .= ".PE\n";
        
  return $string;
}

/**
 * Renders a UMLGraph model by the using the following method:
 *  - write the formula into a wrapped tex-file in a temporary directory
 *    and change to it
 *  - Create an incomplete Postscript file using pic2plot
 *  - Patch the Postscript with some missing procedures     
 *  - convert, trim and add transparency by using 'convert' from the
 *    imagemagick package.
 *  - Save the resulting image to the picture cache directory using an
 *    md5 hash as filename. Already rendered models can be found directly
 *    this way.
 *
 * @param string UMLGraph model
 * @returns true if the picture has been successfully saved to the picture
 *          cache directory
 */
function renderUMLGraph($UMLGraph_Source) {
      global 
        $wgMathDirectory, 
        $wgMathPath, 
        $wgTmpDirectory,
        $wgDvipsCommand,
        $wgImageMagickConvertCommand, 
        $wgImageMagickIdentifyCommand,
        $image_format,
        $tmp_filename,
        $p2p_path,
        $density;

      $UMLGraph_document = wrap_sequence($UMLGraph_Source);

      $current_dir = getcwd();

      chdir($wgTmpDirectory);

      // create temporary pic file
      $winPath = $wgTmpDirectory."/".$tmp_filename.".pic";
      $fp = fopen($winPath,"a+");
      $w=fputs($fp,$UMLGraph_document);
      fclose($fp);
              
      // create temporary Postscript file\
          //by invoking the pic2plot program with the following arguments
          //>pic2plot -Tps /some/path/to/wiki/tmp/dir/somesourcename.pic >
        // /some/path/to/wiki/tmp/dir/somesourcename.ps
      $command = $p2p_path." -Tps ".$winPath." > ".$wgTmpDirectory."/".$tmp_filename.".ps";

      $status_code = exec($command);

      if(!file_exists($tmp_filename.".ps")) {
                cleanTemporarySequenceDirectory(); 
                chdir($current_dir); 
                return false; 
      }

      // imagemagick convert ps to image and trim picture
      $command = $wgImageMagickConvertCommand." -density ".$density.
                  " -trim -transparent \"#FFFFFF\" ".$tmp_filename.".ps ".
          $tmp_filename.".".$image_format;
      $status_code = exec($command);

      // copy temporary formula file to cahed formula directory
      $latex_hash = md5($UMLGraph_Source);
      #Thats not right:
      $filename = $wgMathDirectory."/sequence-".$latex_hash.".".$image_format;

      $status_code = copy($tmp_filename.".".$image_format,$filename);

      cleanTemporarySequenceDirectory();

      if (!$status_code) { 
        chdir($current_dir); 
        return false; 
      }
      chdir($current_dir);

      return true;
}

/**
 * Cleans the temporary directory
 */
function cleanTemporarySequenceDirectory() {
      global 
        $wgTmpDirectory,
        $image_format,
        $tmp_filename;
        
      unlink($wgTmpDirectory."/".$tmp_filename.".pic");
      unlink($wgTmpDirectory."/".$tmp_filename.".ps");
      unlink($wgTmpDirectory."/".$tmp_filename.".".$image_format);
}

/**
 * Tries to match the MetaUML given as argument against the cache. 
 * If the picture has not been rendered before, it'll
 * try to render the MetaUML and drop it in the picture cache directory.
 *
 * @param string model in MetaUML format
 * @returns the webserver based URL to a picture which contains the
 * requested MetaUML model. If anything fails, the resultvalue is false.
 */
function getSequenceImageURL($UMLGraph_Source) {
      global 
        $wgMathDirectory, 
        $wgMathPath, 
        $image_format, 
        $redraw;

      $formula_hash = md5($UMLGraph_Source);

      $filename = 'sequence-' . $formula_hash.".".$image_format;
      $full_path_filename = $wgMathDirectory."/".$filename;

      if (is_file($full_path_filename) && ($redraw == true)) {
        unlink($full_path_filename);
      }

      if (is_file($full_path_filename)) {
        return $wgMathPath."/".$filename;
      } else {
        if (renderUMLGraph($UMLGraph_Source)) {
          return $wgMathPath."/".$filename;
        } else {
          return false;
        }
      }
}

# The callback function for converting the input text to HTML output
function renderSEQ( $input, $argv ) {
  global 
    $density, 
    $redraw;

  if (array_key_exists('density', $argv)) {
    $density = $argv['density'];
  }
  
  if (array_key_exists('redraw', $argv)) {
    $redraw = true;
  }
     
  $url = getSequenceImageURL($input);

  if ($url == false) {
    $text = "[An error occured in UMLGraph extension]";
  } else {
    $text = "<img src='$url'>";
  }

  return $text;
}
?>

[edit] UNIX variant

I have this installed on a UNIX box, with only a few minor modifications.. I can't recall what I did, but, wanted to post it here for everyone to enjoy.

<?php
/**
 * Parser hook extension adds a <uml> tag to wiki markup for rendering UML
 * diagrams within a wiki page using MetaUML.
 *
 * Parameters:
 *   density=width       passed to ImageMagic to set resolution of the image in DPI.  
 *   redraw              force diagram to be redrawn by deleting cached image. 
 **/

// Make sure we are being called properly
if( !defined( 'MEDIAWIKI' ) ) {
  echo(" This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
  die( -1 );
}

$wgExtensionFunctions[] = "wfMetaUMLExtension";

$image_format = "png";
$tmp_filename = md5(rand());
$mpost_path   = "/usr/bin/mpost";
$density      = "100%";
$redraw       = false;

function wfMetaUMLExtension() {
  global $wgParser;
    # register the extension with the WikiText parser
    # the first parameter is the name of the new tag.
    # In this case it defines the tag <uml> ... </uml>
    # the second parameter is the callback function for
    # processing the text between the tags
  $wgParser->setHook( "uml", "renderUML" );
}

/**
 * wraps a minimalistic MetaUML document around the formula and returns a string
 * containing the whole document as string.
 *
 * @param string model in MetaUML format
 * @returns minimalistic MetaUML document containing the given model
 */
function wrap_formula($MetaUML_Source) {
  $string  = "input metauml;\n\n";
  $string .= "beginfig(1);\n";
  $string .= "$MetaUML_Source\n";
  $string .= "endfig;\n\n";
  $string .= "end\n";

  return $string;
}

/**
 * Renders a MetaUML model by the using the following method:
 *  - write the formula into a wrapped tex-file in a temporary directory
 *    and change to it
 *  - Create an incomplete Postscript file using MikTex (mpost)
 *  - Patch the Postscript with some missing procedures     
 *  - convert, trim and add transparency by using 'convert' from the
 *    imagemagick package.
 *  - Save the resulting image to the picture cache directory using an
 *    md5 hash as filename. Already rendered models can be found directly
 *    this way.
 *
 * @param string MetaUML model
 * @returns true if the picture has been successfully saved to the picture
 *          cache directory
 */
function renderMetaUML($MetaUML_Source) {
      global 
        $wgMathDirectory, 
        $wgMathPath, 
        $wgTmpDirectory,
        $wgDvipsCommand,
        $wgImageMagickConvertCommand, 
        $wgImageMagickIdentifyCommand,
        $image_format,
        $tmp_filename,
        $mpost_path,
        $density;

      $MetaUML_document = wrap_formula($MetaUML_Source);

      $current_dir = getcwd();

      chdir($wgTmpDirectory);

      // create temporary latex file
      $winPath = $wgTmpDirectory."/".$tmp_filename.".mp";
      $fp = fopen($winPath,"a+");
      $w=fputs($fp,$MetaUML_document);
      fclose($fp);
              
      // create temporary Postscript file
      $command = $mpost_path." ".$winPath;
  
      $status_code = exec($command);

      if(!file_exists($tmp_filename.".1")) {
        cleanTemporaryDirectory(); 
        chdir($current_dir); 
        return false; 
      }

      // Fix mpost output by adding Postscript procedures
      $infile  = @fopen($wgTmpDirectory."/".$tmp_filename.".1", "r");
      $outfile = @fopen($wgTmpDirectory."/".$tmp_filename.".ps", "a+");
      
      if ($infile) {
        // Copy the first line (%!PS)
        $buffer = fgets($infile);  // , 4096);
        fputs($outfile, $buffer);

        // Add the missing procedures
        fputs($outfile, "/ptmr8r {/ptmr8r findfont .7 scalefont} def\n");
        fputs($outfile, "/fshow {scalefont setfont show} def\n");

        // Copy the rest of the file
        while (!feof($infile)) {
          $buffer = fgets($infile);  // , 4096);
          fputs($outfile, $buffer);
        }
        fclose($infile);
        fclose($outfile);
      }


      // imagemagick convert ps to image and trim picture
      $command = $wgImageMagickConvertCommand." -density ".$density.
                  " -trim -transparent \"#FFFFFF\" ".$tmp_filename.".ps ".
        $tmp_filename.".".$image_format;
      $status_code = exec($command);

      // copy temporary formula file to cahed formula directory
      $latex_hash = md5($MetaUML_Source);
      #Thats not right:
      $filename = $wgMathDirectory."/uml-".$latex_hash.".".$image_format;

      $status_code = copy($tmp_filename.".".$image_format,$filename);

      cleanTemporaryDirectory();

      if (!$status_code) { 
        chdir($current_dir); 
        return false; 
      }
      chdir($current_dir);

      return true;
}

/**
 * Cleans the temporary directory
 */
function cleanTemporaryDirectory() {
      global 
        $wgTmpDirectory,
        $image_format,
        $tmp_filename;
        
      unlink($wgTmpDirectory."/".$tmp_filename.".mp");
      unlink($wgTmpDirectory."/".$tmp_filename.".log");
      unlink($wgTmpDirectory."/".$tmp_filename.".1");
      unlink($wgTmpDirectory."/".$tmp_filename.".ps");
      unlink($wgTmpDirectory."/".$tmp_filename.".".$image_format);
}

/**
 * Tries to match the MetaUML given as argument against the cache. 
 * If the picture has not been rendered before, it'll
 * try to render the MetaUML and drop it in the picture cache directory.
 *
 * @param string model in MetaUML format
 * @returns the webserver based URL to a picture which contains the
 * requested MetaUML model. If anything fails, the resultvalue is false.
 */
function getImageURL($MetaUML_Source) {
      global 
        $wgMathDirectory, 
        $wgMathPath, 
        $image_format, 
        $redraw;

      $formula_hash = md5($MetaUML_Source);

      $filename = 'uml-' . $formula_hash.".".$image_format;
      $full_path_filename = $wgMathDirectory."/".$filename;

      if (is_file($full_path_filename) && ($redraw == true)) {
        unlink($full_path_filename);
      }

      if (is_file($full_path_filename)) {
        return $wgMathPath."/".$filename;
      } else {
        if (renderMetaUML($MetaUML_Source)) {
          return $wgMathPath."/".$filename;
        } else {
          return false;
        }
      }
}

# The callback function for converting the input text to HTML output
function renderUML( $input, $argv ) {
  global 
    $density, 
    $redraw;
  
  if (array_key_exists('density', $argv)) {
    $density = $argv['density'];
  }
  
  if (array_key_exists('redraw', $argv)) {
    $redraw = true;
  }
     
  $url = getImageURL($input);

  if ($url == false) {
    $text = "[An error occured in MetaUML extension]";
  } else {
    $text = "<img src='$url'>";
  }

  return $text;
}
?>

[edit] Another Unix variant (works on FreeBSD)

I had a problem with gettings fonts to display correctly. The original author of the extension modifies the Postscript output by adding the missing procedures related to fonts. A better solution is to add "prologues:=1;" to the wrap_formula() function. This will cause MetaPost to include the font information in the Postscript output. I no longer have any font scaling issues. The diagrams look great! Here is my version of MetaUML.php:

<?php
/**
 * Parser hook extension adds a <uml> tag to wiki markup for rendering UML
 * diagrams within a wiki page using MetaUML.
 *
 * Parameters:
 *   density=width       passed to ImageMagic to set resolution of the image in DPI.  
 *   redraw              force diagram to be redrawn by deleting cached image. 
 *
 */
 
// Make sure we are being called properly
if( !defined( 'MEDIAWIKI' ) ) {
    echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
    die( -1 );
}
 
//Avoid unstubbing $wgParser too early on modern (1.12+) MW versions, as per r35980
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
        $wgHooks['ParserFirstCallInit'][] = 'wfMetaUMLExtension';
} else {
        $wgExtensionFunctions[] = 'wfMetaUMLExtension';
}
 
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'UML',
        'version' => '0.4',
        'author' => 'Bryan A.',
        'url' => 'http://www.mediawiki.org/wiki/Extension:UML',
        'description' => 'Renders a UML model from text using MetaUML.'
);
 
$image_format = "png";
$tmp_filename = md5(rand());
$mpost_path   = "/usr/local/bin/mpost";
$density      = "100%";
$redraw       = false;
 
function wfMetaUMLExtension() {
    global $wgParser;
    # register the extension with the WikiText parser
    # the first parameter is the name of the new tag.
    # In this case it defines the tag <uml> ... </uml>
    # the second parameter is the callback function for
    # processing the text between the tags
    $wgParser->setHook( 'uml', 'renderUML' );
    return true;
}
 
    /**
     * wraps a minimalistic MetaUML document around the formula and returns a string
     * containing the whole document as string.
     *
     * @param string model in MetaUML format
     * @returns minimalistic MetaUML document containing the given model
     */
    function wrap_formula($MetaUML_Source) {
      $string  = "prologues:=1;\n";
      $string .= "input metauml;\n\n";
      $string .= "beginfig(1);\n";
      $string .= "$MetaUML_Source\n";
      $string .= "endfig;\n\n";
      $string .= "end\n";
 
      return $string;
    }
 
    /**
     * Renders a MetaUML model by the using the following method:
     *  - write the formula into a wrapped tex-file in a temporary directory
     *    and change to it
     *  - Create an incomplete Postscript file using MikTex (mpost)
     *  - Patch the Postscript with some missing procedures     
     *  - convert, trim and add transparency by using 'convert' from the
     *    imagemagick package.
     *  - Save the resulting image to the picture cache directory using an
     *    md5 hash as filename. Already rendered models can be found directly
     *    this way.
     *
     * @param string MetaUML model
     * @returns true if the picture has been successfully saved to the picture
     *          cache directory
     */
    function renderMetaUML($MetaUML_Source) {
      global $wgMathDirectory, $wgMathPath, $wgTmpDirectory, $wgDvipsCommand;
      global $wgImageMagickConvertCommand, $wgImageMagickIdentifyCommand, $image_format, $tmp_filename, $mpost_path, $density;
 
      $MetaUML_document = wrap_formula($MetaUML_Source);
 
      $current_dir = getcwd();
 
      chdir($wgTmpDirectory);
 
      // create temporary latex file
      $winPath = $wgTmpDirectory."/".$tmp_filename.".mp";
      $fp = fopen($winPath,"a+");
      $w = fputs($fp,$MetaUML_document);
      fclose($fp);
 
      // create temporary Postscript file
      $command = $mpost_path." -quiet ".$winPath;
 
      $status_code = exec($command);
 
      if(!file_exists($wgTmpDirectory."/".$tmp_filename.".1")) {
          cleanTemporaryDirectory(); 
          chdir($current_dir); 
          return false; 
      }
 
      // Fix mpost output by adding Postscript procedures
      $infile  = @fopen($wgTmpDirectory."/".$tmp_filename.".1", "r");
      $outfile = @fopen($wgTmpDirectory."/".$tmp_filename.".ps", "a+");
 
      if ($infile) {
        // Copy the first line (%!PS)
        $buffer = fgets($infile);  // , 4096);
        fputs($outfile, $buffer);
 
        // Copy the rest of the file
        while (!feof($infile)) {
            $buffer = fgets($infile);  // , 4096);
            fputs($outfile, $buffer);
        }
        fclose($infile);
        fclose($outfile);
      }
 
 
      // ImageMagick convert ps to image and trim picture
      $command = $wgImageMagickConvertCommand." -density ".$density.
                  " -trim -transparent \"#FFFFFF\" ".$tmp_filename.".ps ".
                  $tmp_filename.".".$image_format;
      $status_code = exec($command);
 
      // copy temporary formula file to cahed formula directory
      $latex_hash = md5($MetaUML_Source);
      $filename = $wgMathDirectory."/uml-".$latex_hash.".".$image_format;
 
      $status_code = copy($tmp_filename.".".$image_format,$filename);
 
      cleanTemporaryDirectory();
 
      if (!$status_code) { 
        chdir($current_dir); 
        return false; 
      }
      chdir($current_dir);
 
      return true;
    }
 
    /**
     * Cleans the temporary directory
     */
    function cleanTemporaryDirectory() {
      global $wgTmpDirectory, $image_format, $tmp_filename;
 
      unlink($wgTmpDirectory."/".$tmp_filename.".mp");
      unlink($wgTmpDirectory."/".$tmp_filename.".log");
      unlink($wgTmpDirectory."/".$tmp_filename.".1");
      unlink($wgTmpDirectory."/".$tmp_filename.".ps");
      unlink($wgTmpDirectory."/".$tmp_filename.".".$image_format);
    }
 
    /**
     * Tries to match the MetaUML given as argument against the cache. 
     * If the picture has not been rendered before, it'll
     * try to render the MetaUML and drop it in the picture cache directory.
     *
     * @param string model in MetaUML format
     * @returns the webserver based URL to a picture which contains the
     * requested MetaUML model. If anything fails, the resultvalue is false.
     */
    function getImageURL($MetaUML_Source) {
      global $wgMathDirectory, $wgMathPath, $image_format, $redraw;
 
      $formula_hash = md5($MetaUML_Source);
 
      $filename = 'uml-' . $formula_hash.".".$image_format;
      $full_path_filename = $wgMathDirectory."/".$filename;
 
      if (is_file($full_path_filename) && ($redraw == true)) {
        unlink($full_path_filename);
      }
 
      if (is_file($full_path_filename)) {
        return $wgMathPath."/".$filename;
      } else {
        if (renderMetaUML($MetaUML_Source)) {
          return $wgMathPath."/".$filename;
        } else {
          return false;
        }
      }
    }
 
# The callback function for converting the input text to HTML output
function renderUML( $input, $argv ) {
  global $density, $redraw, $image_format;
 
  if (array_key_exists('density', $argv)) {
    $density = $argv['density'];
  }
 
  if (array_key_exists('redraw', $argv)) {
    $redraw = true;
  }
 
  if (array_key_exists('format', $argv)) {
    $image_format = $argv['format'];
  }
 
  $url = getImageURL($input);
 
  if ($url == false) {
    $text = "[An error occured in MetaUML extension]";
  } else {
    $text = "<img src='$url'>";
  }
 
  return $text;
}

[edit] Unix variant for Solaris

I tried the Unix variant above with mediawiki 1.12 running under Solaris 10. Code above works perfectly. Just getting there is a bit more complex depending on your system. Since I had to install a Tex distribution, I also decided to enable latex formula writing. Here a few notes that may help.

Step: Make sure that latex, dvips, gs (ghostscript), and convert (ImageMagick) installed and available in the PATH. Depending on how the system is installed, this also means to fix the path of the Apache webserver.

It probably would be a good idea to install livetex, but since I found I binary for (older) teTex I went with this. texTex in /opt/sfw wasn't correctly installed. Got a new version from http://www.sunfreeware.com/. This package installs in /usr/local

gunzip tetex-3.0-sol10-sparc-local.gz
pkgadd -d tetex-3.0-sol10-sparc-local

teTex now should be installed and there is some postinstall work to do

  • Add /usr/local/teTeX/bin/sparc-sun-solaris2.10 to the Path.
  • Configure teTex:
texconfig conf

Step: Install texvc. This is a standard Mediawiki script to render Latex math fragments.

  • It's already in the mediawiki distribution
  • Read: w:en:Texvc and compile.

Step: Fix some configuration variables in LocalSettings.php. Some documentation on variables is here:

You have to make sure that all these variables are defined:

$wgUseTeX      = true;
$wgMathPath         = "{$wgUploadPath}/math";
$wgMathDirectory    = "{$wgUploadDirectory}/math";
$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";
$wgImageMagickIdentifyCommand="/usr/local/bin/identify";
$wgImageMagickConvertCommand = "/usr/local/bin/convert";
$wgDvipsCommand="/usr/local/teTeX/bin/sparc-sun-solaris2.10/dvips";

Step: Install MetaUML, UML for LaTeX/MetaPost

  • Get the archive from http://metauml.sourceforge.net/
  • Decompress / dearchive somewhere
  • Copy files into /usr/local/teTeX/share/texmf-dist/metauml
  • Type 'texhash' to let teTex know about this ...

- Daniel edutechwiki.unige.ch

[edit] [An error occured in MetaUML extension]

Hi

This looks like a very useful extension. However when I try to run it I am getting the following error: [An error occured in MetaUML extension]

Any idea how I can fix this?

Thanks --Magick 12:07, 4 January 2008 (UTC)

Generally that means that your syntax has an error. You should be able to find the output file in the temp space and run it manually to verify that its parsing properly. It also might be permissions problems invoking the binaries on the server. --DavidSeymore 13:13, 17 January 2008 (UTC)
Hi,
this Extension is exactly what I need in this moment until a collaborative editing/visualization Visio-like extension is not available (I saw a widget which seems nice but not much integrated in the Wiki, www.mediawiki.org/wiki/Extension:MindMeister).
Unfortunately I'm not able to run this extension on my Wiki. I'm just experimenting it on my localhost server working with WAMPServer (with Windows XP as operating system)
When I add the Example1 code to my Wiki edit page it gives the same message reported just above by Magick (the user).
I think I insatlled properly all the applications that you suggested (metaUML with MikTeX, ImageMagick-6.5.2-Q8 and GhostScript 8.64). The difference I noticed with the suggested Installation tasks is that I don't have Fontmap.GS, anyway I tried both to modify the Fontmap.SGI and .SOL file and to had a Fontmap.GS file found on the Web (all added with the code line you gave), but doesn't work.
When I preview the UML edited page I also get the following warning messages
(after having also created the folder "temp" C:\wamp\www\mediawiki\images by suggestion of a friend since another message was appearing before)
Warning: unlink(C:\wamp\www\mediawiki/images/tmp\9a1d8e7dcd9cc4fd0e9806ea87e3105f.log) [function.unlink]: No such file or directory in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 163
Warning: unlink(C:\wamp\www\mediawiki/images/tmp\9a1d8e7dcd9cc4fd0e9806ea87e3105f.1) [function.unlink]: No such file or directory in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 164
Warning: unlink(C:\wamp\www\mediawiki/images/tmp\9a1d8e7dcd9cc4fd0e9806ea87e3105f.ps) [function.unlink]: No such file or directory in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 165
Warning: unlink(C:\wamp\www\mediawiki/images/tmp\9a1d8e7dcd9cc4fd0e9806ea87e3105f.png) [function.unlink]: No such file or directory in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 166
Then I tried to comment lines from 104 to 108 and 159to167 on metaUML.php but this message appears
Warning: copy(f6423457ad5daa885f892d5abac69a43.png) [function.copy]: failed to open stream: No such file or directory in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 143
Fatal error: Call to undefined function cleanTemporaryDirectory() in C:\wamp\www\mediawiki\extensions\MetaUML.php on line 145
(P.S. What I also did is to unComment in the LocalSettings.php file the lines
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "C:\\Programmi\\ImageMagick\\imageconvert.exe";
but no results)
It would be great if someone could help me! Thanks--Frreeeky 14:40, 08 May 2009 (UTC)


[edit] Error found

Using the Unix variant i'm getting Parse error: syntax error, unexpected T_STRING in /var/lib/mediawiki/extensions/MetaUML/MetaUML.php on line 140 . I don't know anything about php can someone giveme a hand?

[edit] Use in conjunction with PDF Book extension

I've been using the UNIX variant in conjunction with the PDF Book extension and discovered that the UML diagrams don't come out in the PDF it generates. I've tracked this down to the getImageUrl function. To fix it I've simply prefixed each value returned with $wgServer.'/', having imported the $wgServer global at the top of the function. Since I'm not very well versed in PHP, and don't know if this would have any unforseen side-effects, I've not edited the script on the site directly.

[edit] Metapost extension

This particular implementation of UML diagrams is nothing more than a normal Metapost diagram with a particular macro subset employed. As such, it seems to be more worthwhile to just use Extension:Metapost to achieve exactly same result.

Additionally, there's no need to produce an intermediate .ps file and manually patch it, as Metapost is perfectly capable of producing a correct EPS with optional font embedding. This is controlled by the "plologues" internal variable.

[edit] Other UML tools

The Extension:PlantUML is doing the same thing with PlantUML.

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox