@see title.

CommentFileSizeAuthor
#1 libraries-external.patch1.18 KBfubhy
libraries-external.patch691 bytesfubhy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fubhy’s picture

Title: External library pathes are always marked as "not found" because of bogus file_exists() calls for them. » External library pathes not working due to file_exists() validations.
FileSize
1.18 KB

There are more places in the code where file_exists() is called on external pathes.

sun’s picture

Status: Needs review » Needs work
+++ b/libraries.module
@@ -456,7 +456,7 @@ function libraries_detect($name) {
-  if ($library['library path'] === FALSE || !file_exists($library['library path'])) {
+  if ($library['library path'] === FALSE || (!url_is_external($library['library path']) && !file_exists($library['library path']))) {

This begs the question of whether we should rename 'library path' into 'uri' ?

+++ b/libraries.module
@@ -727,8 +727,9 @@ function libraries_get_version($library, $options) {
+  $external = url_is_external($library['library path']);
+  $file = (!$external ? DRUPAL_ROOT . '/' : '') . $library['library path'] . '/' . $options['file'];
+  if (empty($options['file']) || (!$external && !file_exists($file))) {

That's veeery compact ;)

Let's use a less sparse control structure:

$file = ...;
if (!$external = url_is_external(...)) {
  $file = DRUPAL_ROOT . '/' . $file;
}
+++ b/libraries.module
@@ -727,8 +727,9 @@ function libraries_get_version($library, $options) {
   $file = fopen($file, 'r');

All of that being said, I wonder why the file_exists() does not work?

The fopen() works, but the file_exists() does not?

Sounds strange to me.

tstoeckler’s picture

Status: Needs work » Closed (duplicate)

Sorry for letting this sit so long before closing this down, but this is definitely duplicate of #864376: Loading of external libraries. You can see from the patches there, that I followed a similar path.