Patch (to be ported)
Project:
GELF
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jun 2012 at 14:03 UTC
Updated:
3 Jul 2012 at 20:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
glennpratt commentedThere we go.
Comment #2
patcon commentedtagging
Comment #3
glennpratt commentedAdded composer.json
Comment #4
glennpratt commentedFixed composer.json with Rob Loach's help.
Comment #5
glennpratt commentedSorry, forgot to stage the changes.
Comment #6
robloachCleaned up gelf_require() a bit, and made the status report use it. Checks gelf/vendor/autoload.php and sites/all/vendor/autoload.php (or sites/example.com/vendor/autoload.php if sites/example.com/modules/gelf).
Comment #7
glennpratt commentedGood catch!
Even if the class is loaded, this will cause subsequent calls to this function to fail because the block above is bypassed.
I would lean toward just class_exists. Though I don't have a benchmark, I imagine the static cache would be better used preventing a call to this function entirely in gelf_watchdog().
Comment #8
robloachWhoops!
Comment #9
glennpratt commentedI removed the static cache because of that hiccup in testing for now, we got by calling core api, libraries API and require every call before :)
This patch actually tested, unlike my others ;)
Comment #10
glennpratt commentedAhh, cross-posted.
Comment #11
glennpratt commentedI realized this wouldn't work in our case because we install contrib modules into a contrib directory - I don't believe we are the only ones doing that.
Perhaps conf_path() is a better choice?
Comment #12
msonnabaum commentedI'm not sure we should support /sites/all/vendor. Is that a documented convention? Feels arbitrary to me.
Comment #13
glennpratt commentedI feel like we're trying to come up with a convention here. My argument for searching
/profile/%name%/vendoris the profile is where my composer.json lives (and makefile and functional tests, etc). I think that is a good pattern, however your active site could include code from the profile and from/sites/alland/sites/default(or whatever site).So my current thought is the active site (
conf_dir()) is the most rational place to look.sites/default/vendorfor example.I think we're going to need to try this stuff out and build tools for it - it might just be too much for this issue.
NOTE: To clarify, I mean look for the autoloader in
sites/default/vendoror similar, not composer.json.Comment #14
msonnabaum commentedWell, my thought is, if you have your vendor in /profile or /sites/all, then you should include that somewhere else, like maybe your settings.php or something. If you've already included it, we check with class_exists, it's autoloaded, and we dont need to look for a vendor dir local to the module directory.
That seems reasonable to me and covers the all use cases without trying to establish new conventions.
Comment #15
glennpratt commentedI totally agree, though in retrospect I can see how I may have led the conversation astray - as long as the class_exists comes first I'm happy.
Comment #16
robloachLooks pretty good to me!
Comment #17
msonnabaum commentedFix the missing quote in the composer example and it's good.
Comment #18
glennpratt commentedCommitted to 7.x-1.x. Thanks.
http://drupalcode.org/project/gelf.git/commitdiff/4389d96300b2e5e76154b4...
Moving to 6.x