Extension talk:PlantUML

Problem with Title
Hello! I've found a bug in the classical version - at least in combination with MediaWiki 1.15: The usage of $wgTitle as MD5 source does not work - it always results in an empty string. As a result, all images are stored as "uml--(CodeHash).png" - and when another page is saved, the cleanImages deletes ALL images. Other (cached) pages then can't find their images unless they are re-created.

As a fix, instead of using global $wgTitle (which is also described as not to be used), I'm using the following function: function getPageTitle { global $wgArticle; $title = $wgArticle->getTitle->getText; return $title; } and use getPageTitle instead of $wgTitle.

I don't know whether this is the best solution, but for now it works as intended - image files are stored with a proper hash for the title AND are kept for all pages :).

- Ok, thanks, I've just made the correction (April 29th, 2011)

Actually, it seems to depend of MediaWiki, so I suggest the following code:

function getPageTitle { global $wgArticle; global $wgTitle; // Retrieving the title of a page is not that easy if (empty($wgTitle)) { $title = $wgArticle->getTitle->getText; return $title; }   return $wgTitle; } Any though ?

GraphViz
I found that GraphViz was required to have this working... you might want to add this to the install instructions?

- Ok, thanks for this suggestion!

Changed font
Hi - I installed on our test environment (without GraphWiz) and it worked fine (the first example on the article page). But on our real environment the font suddenly changed (test: Arial, real: some kind of joined up Word link font). Any idea why this is? The skin on both is the same. --Robinson Weijman 11:27, 5 February 2010 (UTC)

I am not sure to understand your issue. Could you contact me by mail (plantuml@gmail.com) ? Thanks - 13 February 2010
 * Thanks for the reply. We solved the issue - each environment had a different version of java.  Now that this is corrected, the problem is resolved.  --Robinson Weijman 09:17, 15 February 2010 (UTC)

Spaces in Windows Apache Home Path
On my windows machine I had to change:

to

Otherwise the script failed because of some spaces in the installation path of the Apache. Maybe someone with more experience in php than myself could fix this to a more robust version.

How it run into CentOS?

 * It works in Ubuntu and FreeBSD, but i can't run it into CentOS.

You should double check that the Sun JVM is used, and not the OpenJDK.

error on uploading?
hello

I get this error when doing regular uploads

Fatal error: Call to a member function getTitle on a non-object in /var/www/tids/extensions/PlantUML.php on line 181

BTW useful extension and thanks

Msevero 08:06, 30 April 2011 (UTC)

Ok, I just change the getPageTitle function. Does it work better ?

PlantUML 20:19, 30 April 2011 (UTC)

CPanel Centos php.ini edit fix
In running my MediaWiki off of a CPanel hosted site I was continually getting:

[An error occured in PlantUML extension]

Every now and then I would see this:

Warning: copy [function.copy]: URL file-access is disabled in the server configuration in /home/username/public_html/extensions/PlantUML.php on line 98 Warning: copy(http://www.plantuml.com/plantuml/img/ROr1RW8n34NtEOMNPT4B83GIK9LkA8jH3_0Ph19D9XuSJojktoI3119Tsdv-pwNUnn6AWQR47H9lqFNVAbCyRIM8qXkqRnaxPOxkYLwhokyC7eB_uGS2dObkH4-iCt0CMVsiU4HgBC1ufxZ-KolATudsYO5fAvDwLkU-4YkjLlGn3OZKD6wvXuzPPZZchoKXqVxQNaA1rkCOV0VpKj6Nrg2sA9T3P6hFOdMTdMHd9jpnHV6KGwLh8fDp_RMXc-asbqL1tHo-pty0) [function.copy]: failed to open stream: no suitable wrapper could be found in /home/username/public_html/extensions/PlantUML.php on line 98

After some Google Searching I found references to disabling this by default to prevent certain attacks.

Create a php.ini file containing this entry:

allow_url_fopen = On

Upload it to /username/public_html (where your LocalSettings.php file would be) and now I no longer get the error messages and the PlantUML files render as expected in the article.

New classic version.
Hi, I would like to contribute a new "classic version" which follows mediawiki standards more and is able to handle image maps and SVG graphics. Pleas advise for best approach.

--Pjkersten 15:23, 5 May 2011 (UTC)

Hello, good idea! It depends wether you know already MediaWiki engine or not. Any maybe it should be better to put the code of this new "classic version" into a really repository (SVN/GIT). For imagemap, as long as there are some URL in the diagram description, a cmap file will be generated with the PNG file. (See [])

You will probably have to parse this cmap file.

You may have a look to this extension Extension:ImageMap which shows how to enable imagemap in MediaWiki.

--Plantuml 17:17, 5 May 2011 (UTC)

Actually, it's already finished. Tested and working - at least, for me that is. Any preferences for bzr, sf or git?

--Pjkersten 19:59, 5 May 2011 (UTC)

Wow, I am curious to see the result. Thanks for your job. Actually, since several plugins are on [] so maybe git is a good option.

--Plantuml 20:49, 5 May 2011 (UTC)

I've created a project on github If you have remarks, please mail me (somehow I don't receive updates for this page).

--Pjkersten 10:04, 6 May 2011 (UTC)

Quick & dirty fix to allow additional html tags for formatting (and linking to source picture)
Hi,

I did a small modification to the PNG rendering to add custom html tags to the header. Reason was to reduce the resulting image size. The image now also links to the original file behind.

Changed functions below. Modified and tested only the PNG case, renderSVG still has to be modified.

function renderPNG($image,$argv) { //the same... if ($image['map']) { $usemap = ' usemap="#'.$image['mapid'].'"'; } else { $usemap = ''; }   return "{$image['map']}"; //added $argv and link here }

function renderUML( $input, $argv, $parser=null ) { global $plantumlImagetype; $image = getImage($input, $parser); if ($image['src'] == false) { $text = "[An error occured in PlantUML extension]"; } else { if ($plantumlImagetype == 'svg') { $text = renderSVG($image); } else { //recreate html-tags from $argv $args = ''; foreach ($argv as $tag => $tagval) {			$args .= " $tag=\"$tagval\" "; }           $text = renderPNG($image,$args); //added $args to function call }   }    return $text; }

PlantUML with a dedicated plantuml server behind proxy
Hello,
 * while using plantuml with a dedicated instance in cloud mode

$usecloud = true;
 * you should sometime be able to specify a proxy (eg. avoiding "Connect timeout" error).
 * To do this, you should replace " " by a dedicated mechanism including proxy config.
 * Here is the actual code (PlantUml.php:line 231)


 * Here is the expecting code to set "betweenProxyHost.intranet'" proxy server : a proxy between your mediawiki server and the dedicated.plantuml.server.intranet src :


 * Enjoy.
 * --Boly38 (talk) 13:18, 19 February 2013 (UTC)