libraries_get_path() should not anymore return 'sites/all/$library' as a best effort. We're better than that now. As sun correctly pointed out in #958162: Allow groups of callbacks to be applied to libraries this constitutes an API change, and, since we don't have a release for D7 yet, will break a lot of sites out there. So this should/can only be done after we tag an alpha release in Drupal 7. Marking postponed on #881362: Ready for another tagged release? because of that.
Comment | File | Size | Author |
---|---|---|---|
#10 | libraries_get_patch_false_2.patch | 1.91 KB | tstoeckler |
#6 | libraries_get_patch_false.patch | 815 bytes | tstoeckler |
#2 | 961476-libraries_get_path.patch | 977 bytes | tstoeckler |
Comments
Comment #1
sunIdeally, we'd hear from heavy users like acquia or devseed about their preference regarding this API change. If there will be no feedback, then I'd say to simply do the API change, without any alpha release upfront. Technically, we're still in "code thaw"...heheh ;)
Comment #2
tstoecklerA simple patch.
Comment #3
tstoecklerOh sorry, crosspost.
Sure.
Comment #4
tstoecklerNow that we have the new branch, this should be less problematic. Marking needs review, to see if the bot picks it up. It should still apply, but you can never be sure...
Comment #6
tstoecklerHere's a reroll.
Comment #7
sunDoesn't seem to be covered by tests yet though?
Comment #8
tstoecklerNo, this is not properly tested yet.
I don't really know how that would work, though, because we would have to put something in sites/all/libraries for testing libraries_get_path() to be at all meaningful.
Another thing, is that libraries_detect() currently does:
That means that for each library which doesn't have library path set we still run a useless file_exists() on the path returned by libraries_get_path(). Now it could be considered micro-optimization (which is why I didn't include it in this patch), but we could also do for instance:
I don't really like that code flow though. There might be a nicer way to do that, though, which is why I'm bringing it up.
Comment #9
sunI may be mistaken, but this patch changes the return value for non-existing libraries, so I don't see why we'd need a library anywhere to verify that the path for a non-existing library yields FALSE?
File system I/O for non-existing files is slow, so we definitely should do this:
Comment #10
tstoecklerYes, that code flow is muuuch better.
How about this, then?
Comment #11
sunThanks for reporting, reviewing, and testing! Committed to master.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.