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.
The libraries_load() function always stores the result of its call to libraries_detect() into the DB cache, but I really don't think that it should do so when detection fails. This causes a very bad user experience when they fail to install a library correctly the first time, then fix their install and try again. Trying again will continue to show that the library isn't installed, even though it is, because the failure to detect the library has been cached.
I've included a patch for this change.
Comment | File | Size | Author |
---|---|---|---|
libraries-dont_cache_detection_failures.patch | 470 bytes | coredumperror | |
Comments
Comment #1
tstoecklerHmm... I totally get the notion of that. The current behavior really is suboptimal.
However, the current behavior allows for optional integration of libraries without any performance hit. I.e. I can just do
With your patch that would mean that the file is being detected (including possible parsing some file for version information) on each request. I think the proper way to solve this would be to provide a proper UI with steps on how to install a particular library that also gives appropriate feedback. On that page we could then clear the library cache on each request.
Therefore, closing this ticket, sadly.
Please do re-open if you have other ideas on how to solve this while allowing for both use-cases. And thanks a lot for your input, much appreciated.