When determining where the flexslider library is installed, the flexslider_library() function does an extra file_prepare_directory() on the path provided by the libraries module.
In my case on my server, the libraries folder is *not* writable by the user running apache, and i dont think this is an uncommon situation. I have flexslider library installed in sites/all/libraries, but because "file_prepare_directory" fails, it always falls back to the (nonexistent) copy of flexslider provided by the module.
This is the code in question:
function flexslider_library() {
$path = drupal_get_path('module', 'flexslider');
// If the library isn't found in Drupal, fall back to a copy of the library
// included with the module.
$library_path = libraries_get_path('flexslider');
$library_fullpath = $_SERVER['DOCUMENT_ROOT'] . base_path() . $library_path;
if (empty($library_path) || !file_prepare_directory($library_fullpath)) {
$library_path = $path . '/libraries/flexslider';
}
// ...
Why should this module need to have write abilities to a third-party library directory?
Comment | File | Size | Author |
---|---|---|---|
#5 | flexslider_add_library-1817754.patch | 557 bytes | quicksketch |
Comments
Comment #1
minorOffense CreditAttribution: minorOffense commentedNo you're right. You shouldn't need to have write privileges. Let's see if we can update the check to skip that step.
My PHP file I/O isn't terribly good, any chance you can supply a patch?
Comment #2
jwilson3How about just removing the call to file_prepare_directory, libraries_get_path() already has the logic for detecting if the library exists, so the if empty($library_path)) should be enough.
Comment #3
garrettc CreditAttribution: garrettc commentedI can confirm that jwilson3's edit in #3 fixes this issue.
Comment #4
minorOffense CreditAttribution: minorOffense commentedComment #5
quicksketchAlso confirmed. Here's a patch representing the fix in #2.
Comment #6
gabriel.achille CreditAttribution: gabriel.achille commentedAlso confirmed. patch proposed in #5 fixed the issue.
Comment #7
minorOffense CreditAttribution: minorOffense commentedPatch committed.