Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the user has a misconfigured filesystem (basically if the webserver cannot file_save_data() correctly), the installation of this module will throw an error:
Fatal error: Call to a member function set() on boolean in /var/www/d8media0/web/modules/contrib/file_browser/file_browser.install on line 20
The reason is that
$file = file_save_data($data, 'public://file_browser_icon.png', FILE_EXISTS_REPLACE);
not always will work, so $file->set()
some lines later will break.
Not sure the best way to deal with this, but perhaps we should check if the file_save_data() is possible in hook_requirements() and only proceed if yes.
Comment | File | Size | Author |
---|---|---|---|
#4 | prevent-installation-if-public-filesystem-not-writable-2759261-4.patch | 751 bytes | marcoscano |
|
Comments
Comment #2
marcoscanoComment #3
samuel.mortensonWouldn't multiple features in Drupal not work if the web user can't write to
public://
? I'm wondering if this is out of scope since it's a server configuration problem, but if you submit a patch I'll be happy to review it. :-)Comment #4
marcoscanoSure!
But the whole point here is to avoid WSOD even if the server is misconfigured :)
Attached an approach in hook_requirements.
Comment #6
samuel.mortensonThis seems to be working and passed tests, sorry for the late commit!