dokufreaks / plugin-filelist

The filelist plugin provides a syntax for adding linked and sorted lists of files as selected by wildcard based glob patterns to a wiki page and thus allows dynamically including file listings of arbitrary filesystem locations and media namespaces.
https://www.dokuwiki.org/plugin:filelist
GNU General Public License v2.0
13 stars 9 forks source link

Plugin not listenting files. #41

Open nitromethanol opened 5 months ago

nitromethanol commented 5 months ago

This plugin, updated until today, only show "[n/a: No Match]" . If add some extra options like "&direct=1" just report an error on PHP.

To fix this add this code to /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php file, on line 237: if (str_ends_with(strval($this->webdir), '=')) {

KaiMartin commented 5 months ago

In my case, filelist works fine, even with the option "&direct=1". This particular option just gets ignored, since it got dropped since the recent rewrite. My dokuwiki resides on a linux served by apache2 2.4.57 and php 8.2.7 .

However, due to the rewrite of the plugin, I had to add proper aliases to paths in the dokuwiki config and modify all my calls to filelist accordingly.

splitbrain commented 5 months ago

I cannot reproduce the error. @nitromethanol please provide the complete syntax and your path configuration.

nitromethanol commented 5 months ago

Hi @splitbrain . Here is my code, but do not understand why yo need it. Thanks anyway. Regards.

{{filelist>/var/www/wikiredes-nueva/data/pages/__/files*.txt&direct=0&style=table&showdate=1}}

splitbrain commented 5 months ago

Still can't reproduce it. &direct=0 is simply ignored as mentioned by @KaiMartin.

I just saw "report an error on PHP" - what error?

nitromethanol commented 5 months ago

Hi. Seams that "direct" do no do a thing. But if I do not convert to String '$this->webdir' variable, it's wont list files. I replace the code to original one and verified. I am using Lighttpd v1.4.59 and PHP v7.4 . Now, cannot run on foreground for debugging. Sorry.

splitbrain commented 5 months ago

closing this. there's simply no useful info for debugging here.

nitromethanol commented 5 months ago

Hi @splitbrain,

Finally, I was able to recreate the error by upgrading this plugin again. This is the error that appears on the screen:

TypeError: Argument 1 passed to str_ends_with() must be of the type string, null given, called in /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php on line 237
An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the filelist plugin.
More info has been written to the DokuWiki error log.

No more errors were found in the syslog. If I modify line 237, it starts working again. I hope it could be helpful for someone. Regards.

splitbrain commented 5 months ago

please provide the stack trace from the dokuwiki error log.

nitromethanol commented 5 months ago

Ofcourse. THANKS for Dokuwiki @splitbrain !!

2024-04-04 12:10:19     /var/www/wikiredes-nueva/inc/compatibility.php(117)     TypeError: Argument 1 passed to str_ends_with() must be of the type string, null given, called i
n /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php on line 237
  #0 /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php(237): str_ends_with()
  #1 /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php(208): dokuwiki\plugin\filelist\Output->itemWebUrl()
  #2 /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php(187): dokuwiki\plugin\filelist\Output->renderItemLinkXHTML()
  #3 /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php(111): dokuwiki\plugin\filelist\Output->renderItemLink()
  #4 /var/www/wikiredes-nueva/lib/plugins/filelist/Output.php(53): dokuwiki\plugin\filelist\Output->renderTableItems()
  #5 /var/www/wikiredes-nueva/lib/plugins/filelist/syntax.php(135): dokuwiki\plugin\filelist\Output->renderAsTable()
  #6 /var/www/wikiredes-nueva/inc/parser/renderer.php(126): syntax_plugin_filelist->render()
  #7 /var/www/wikiredes-nueva/inc/parserutils.php(691): Doku_Renderer->plugin()
  #8 /var/www/wikiredes-nueva/inc/parserutils.php(158): p_render()
  #9 /var/www/wikiredes-nueva/inc/parserutils.php(97): p_cached_output()
  #10 /var/www/wikiredes-nueva/inc/Ui/PageView.php(67): p_wiki_xhtml()
  #11 /var/www/wikiredes-nueva/inc/Action/Show.php(40): dokuwiki\Ui\PageView->show()
  #12 /var/www/wikiredes-nueva/inc/template.php(120): dokuwiki\Action\Show->tplContent()
  #13 [internal function]: tpl_content_core()
  #14 /var/www/wikiredes-nueva/inc/Extension/Event.php(134): call_user_func_array()
  #15 /var/www/wikiredes-nueva/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger()
  #16 /var/www/wikiredes-nueva/inc/template.php(102): dokuwiki\Extension\Event::createAndTrigger()
  #17 /var/www/wikiredes-nueva/lib/tpl/credistyle_v2_2017/main.php(60): tpl_content()
  #18 /var/www/wikiredes-nueva/inc/actions.php(30): include('/var/www/wikire...')
  #19 /var/www/wikiredes-nueva/doku.php(131): act_dispatch()
  #20 {main}
splitbrain commented 2 months ago

@nitromethanol I am still not sure what's going on. The issue is that the webpath config is empty for this path but this shouldn't happen. Unfortunately you still have not provided the path configuration for the plugin as requested.