backdrop-contrib / filebrowser

The FileBrowser module displays contents of a given directory as a node on your Backdrop site - do not use together with Filebrowser AJAX module
GNU General Public License v2.0
0 stars 3 forks source link

PHP compability: Function create_function() is deprecated #2

Open indigoxela opened 4 years ago

indigoxela commented 4 years ago

Full log message:

Deprecated function: Function create_function() is deprecated in theme_dir_listing_list_view() (line 253 of ..../modules/filebrowser/filebrowser.theme.inc).

PHP Version: 7.2.28 Apache: 2.4 Filebrowser: 1.x-1.1.0 (stable, released 2016)

This is probably the related D7 issue: https://www.drupal.org/project/filebrowser/issues/3061756

nattywebdev commented 9 months ago

Is there any update on this issue? I am using filebrowser for the first time and see this remains as an issue for: PHP version: 7.4.27 Filebrowser: 1.x-1.1.0

Thank you for any advice!

nattywebdev commented 9 months ago

On further investigation I found that this D7 module patch works when applied to the Backdrop module: https://www.drupal.org/project/filebrowser/issues/3061756#comment-14131345

I've adapted this (with a slight alteration of drupal_strtolower to backdrop_strtolower) and this works just fine, fixing the displayed message above.

At the same time I addressed another annoyance - the file/folder icons don't display as the containing has a hard-coded style (width:1%) that I've replaced with a friendlier class='icon'. This is in reference to the same issue reported in the D7 issue queue for 'File icons not showing': https://www.drupal.org/project/filebrowser/issues/2824285

I attach a patch file - and welcome anyone that wants to test this. filebrowser.theme.patch

argiepiano commented 9 months ago

We have a PR for this: #6.

Thanks, @nattywebdev

klonos commented 9 months ago

I've reviewed the code changes and provided some feedback and code suggestions (mainly coding standards). @nattywebdev has addressed those, and the code now looks good 👍🏼

Next, we need someone to test this and confirm that it works as expected and that there is nothing accidentally broken.

indigoxela commented 9 months ago

Don't wait for me here, just move on. :wink: Although I initially reported the issue, I never actually used the module.

argiepiano commented 9 months ago

@nattywebdev, I'm trying to test your PR, but I just can't get this module to work, either before or after applying the patch. Perhaps I'm misunderstanding how this is used (I've never used it before). I enabled it and then visited Content > Add content > Directory Listing. As soon as I try that, I get a fatal error: Attempt to modify property "visible_columns" on null in filebrowser_form(). Can you share any clues on how you use this module? The directions are very short, and only say "To actually use the module, create a node of the content type "directory listing" (supplied by this module). Make sure you fill out correctly the field "The system file path to the directory".", which is what I'm trying to do.

nattywebdev commented 9 months ago

That's strange @argiepiano . I didn't see that error, nor do I if I try to create another Directory Listing node (although I do get a new error I've not noticed before - see below).

I'm using Backdrop 1.26.1 on a local dev PC using php 7.4.27, in case that helps.

nattywebdev commented 9 months ago

The module works by creating a node which has a root directory specified, with various options about further features provided, such as ability to see subdirectories, allowing new folders to be created, allowing file uploads and display features. I'm using it with Content Access and private files so I can limit the access to the files displayed and (so far) it's working well.

argiepiano commented 9 months ago

Thanks! I am trying in PHP 8.1 - perhaps that's the issue. I'll try later with php 7.4.