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?

CommentFileSizeAuthor
#5 flexslider_add_library-1817754.patch557 bytesquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

minorOffense’s picture

No 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?

jwilson3’s picture

How 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.

- if (empty($library_path) || !file_prepare_directory($library_fullpath)) {
+ if (empty($library_path)) {
garrettc’s picture

I can confirm that jwilson3's edit in #3 fixes this issue.

minorOffense’s picture

Status: Active » Needs review
quicksketch’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
557 bytes

Also confirmed. Here's a patch representing the fix in #2.

gabriel.achille’s picture

Also confirmed. patch proposed in #5 fixed the issue.

minorOffense’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Patch committed.