lupo49 / dokuwiki-plugin-dir

Dir plugin for DokuWiki
http://www.dokuwiki.org/plugin:dir
6 stars 10 forks source link

Plugin-dir with cols=tags writes/corrupts data/index/topic.idx #6

Open LukasDrude opened 12 years ago

LukasDrude commented 12 years ago

Versions:

I use the Plugin-dir the following way, if I do not use the "tags"-keyword, the error does not occur: ~~DIR?cols=page;tags;mdate~~

Each refresh of the page containing the above statement modifies the file data/index/topic.idx so that it becomes incorrect. For example pages seem to have tags, which they in fact do not have. Some pages are listed twice within one tag.

To visualize this for a human reader, I modified the "topic.idx" with "sed": cat topic.idx | sed 's/}/\n}\n\n/g' | sed 's/i:/\n i:/g' > topic_nice.idx

I was now able to compare the version after a rebuild with "Tagindex Manager" (here are just parts):

    +s:4:"java";a:8:{
       i:0;s:8:"freemind";
       i:1;s:12:"zettelkasten";
    +  i:2;s:9:":freemind";
    +  i:3;s:27:":gruenes_curry_huehnerbrust";
    +  i:4;s:28:":hackfleisch_gruener_pfeffer";
    +  i:5;s:21:":ingwer_moehren_suppe";
    +  i:6;s:8:":kdialog";
    +  i:7;s:13:":zettelkasten";
     }

As you can see, the pages "freemind" and "zettelkasten" are now added twice (once with colon and once without). Also all other added entries are not related to the tag "java" in any way.

(If you need further information, please let me know. This is my first issue submission and I was not able to understand the source-code without additional comments.)

lupo49 commented 12 years ago

Please change the line 257 in syntax.php to

$html = $plug->td (cleanID($id)) ;

Michitux discovered that the dir plugin passes the page $id's in an uncleaned version (preceded with a colon) to the tag helper functions.

http://dump.lupo49.de/tmp/dokuwiki/dir_plugin_function_call.png

LukasDrude commented 12 years ago

Thank you for your fast response. Indeed your correction improves the situation. Double entries because of pages added twice (once with colon and once without) do not occur anymore.

Anyhow the file topic.idx is still modified when calling the dir-plugin with the tags-flag. Each call modifies the file a bit (introducing some mistakes) and after several calls (reloading the page), it does not change anymore.

In the short future I will provide an example installation (like a minimal example), which hopefully presents this error.

lupo49 commented 12 years ago

Thats because of how the tag plugin handles the call of td($id). It requests the tag-related metadata of the passed $id which leads in the end to a refresh of your file.

But you are right, pulling the metadata shouldn't modify your file in a strange way. (Of course, the file would be modified in a proper way, when no tag-related metadata exists or it needs a refresh: http://xref.dokuwiki.org/reference/dokuwiki/nav.html?_functions/p_get_metadata.html)

LukasDrude commented 12 years ago

I was trying to reconstruct the error with a minimal example, but I did not succeed. I will resume, when I managed to reconstruct it.

michitux commented 11 years ago

In the current version of the tag plugin the tag plugin no longer uses a custom tag index but the DokuWiki metadata index and the code has been changed such that pages don't influence each other anymore when they are listed on the same page. Could you please test if this has also fixed your problems?