[dokuwiki] Plugins with standalone scripts

Hello,

There are some plugins that provide standalone scripts that are directly
called from the web and not through a DokuWiki wrapper. This is the case
for the captcha plugin, for instance, that provides wav.php and img.php,
that get directly referenced in the registration page:
> <img src="/dokuwiki/lib/plugins/captcha/img.php?…">

As they are called directly, these scripts do not get any variable from
DokuWiki. In the case of captcha, they define DOKU_INC by themselves,
assuming there are three directories above the DokuWiki installation
directory:
> define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/');

This is okay with regular installations, but may cause problems when the
plugins directory has been moved somewhere else and symlinked to its
expected location: in that case, '../../../' will not be the DokuWiki
installation directory.

This may be considered as a problem of the non-standard installation.
But I did not see anywhere in the documentation that plugins are
supposed to be able to provide standalone scripts, so I see that as a
non-documented feature, that should not be considered as guaranteed to
work at all. What do you think of this issue? Should it be considered as
a bug of these plugins, that are expecting things they should not?

Regards,

-- 
Tanguy Ortolo
Maintainer of the Debian package for DokuWiki, that does move away the
plugins directory…

Other related posts: