[dokuwiki] Executing code in plugin's conf/metadata.php

  • From: Luis Machuca Bezzaza <ryan.chappelle@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 07 Mar 2011 00:56:05 -0300

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings people.

May I ask for help about a strange problem for which I can't find a
reasonable cause?

I am the maintainer of the NoIEWarning plugin[1], which in its latest form
does some dynamic stuff in 'conf/metadata.php' in order to read the list of
available choices for a combobox. Specifically, the opendir[2] family of
functions is used to read the filenames in a directory ("recommendation
directory") and the values are fed to the valid choices for the metadata's
'_choices' array.

The code runs well and without issues so far, but it seems to be causing
some sort of conflict with the Configuration Manager and some other plugins,
 with two notorious effects. This is tested in both the Lemming and Anteater
releases.

1.- Entering the Configuration Manager's configuration page *cuts* the page
content at this plugin; no controls for any *later* plugin, or for the
template either, are shown, and they do not appear in the generated code
either. The plugins and their configuration seem to be loaded, as one plugin
which sent a notice (via msg()) during its constructor was called
nonetheless, but I couldn't make sure.

2.- Only in the Lemming release, and probably related to the above, *all*
the  variables for this plugin appear in the "uncategorized settings"
section of the configuration manager, when that section is enabled.
Otherwise the output of the section is not affected by this issue; the same
variables are shown regardless of which plugins are "cut off" of the list.

Prepending a '@' to all the function calls does not change the observed
behaviour. Commenting out the entire processing code and leaving only simple
declarations in metadata.php solves the issue, but at the cost of (duh!)
removing any processing intelligence for the plugin's configuration
controls. Seeing as allowdebug mostly displays server info (and it is a
separate action from the configuration manager), it seems to be of no use to
me here.

Am I doing something (or worse, everything) wrong by adding processing tasks
to metadata.php? If it is indeed possible to do what I want to do, is there
any existing plugin using this technique for me to examine?

I'm linking to a pastebin of the affected code[3] (file sans comments). If
unavailable, the plugin can be downloaded and examined from the plugin
page[1]. Would like to get help on this problem, as even though it seems
nonfatal and stuff, it *does* prevent people from configuring other plugins
if they use mine.

Thanks in advance.

Relevant links:

[1] http://dokuwiki.org/plugin:noiewarning
[2] http://php.net/manual/en/function.opendir.php
[3] http://pastebin.com/XYFGWxSN

- --
- ----
Luis Machuca Bezzaza
Secretario (S) GULIX - Grupo de Usuarios de GNU/Linux de la IX Región
http://www.gulix.cl/
- ----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)

iEYEARECAAYFAk10V1UACgkQ2o3b1t8iZA8pqQCgkJ1pvvRTc1h5vibecxe/SqZO
1HsAn2yShQeca/6y4o+l/KglbznFaB2h
=qYgl
-----END PGP SIGNATURE-----

-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: