Currently mongodb_watchdog uses not one but two variables to defined the watchdog collection name: at some places, it uses mongodb_collectionname, while at others it uses mongodb_watchdog_collectionname. This does not break by default as both are defaulted to watchdog, and any user who customized their collectionname is likely to have noticed the two variables and set both accordingly, but should be fixed.
I think it would be best to standardize on the latter, to let other modules customize their own collectionname.
The mongodb_session module also uses a customizable collection name, in mongodb_session. Going further, we might want to have a unified mechanism through which submodules could define their collection(s) and have them be customized in a UI in a unified way.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 1173058-6.patch | 9.12 KB | fgm |
| #5 | mongo_wdvars-1173058-5.patch | 8.35 KB | fgm |
| #4 | mongo_wdvars-1173058-4.patch | 8.35 KB | fgm |
| #3 | 1173058-mongo_wdvars.patch | 6.47 KB | andypost |
| #1 | inconsistent_variable_use-1173058-1.patch | 4.06 KB | fgm |
Comments
Comment #1
fgmSuggested patch aligns on
mongodb_watchdog_collectionname.Comment #2
fgmAlso note, a larger fix for this whole 'collection name' question can also be found in the 6.x branch at #971232: Collection name variables should be removed. I feel the decision to use hardcoded collection names instead of having them in variables should be reconsidered, though: under some circumstances, it can be very useful to be able to switch collection on the fly without having to patch code for this: I had a use case for this very recently.
Comment #3
andypostSuppose a shorten name is better. Also adds hook_update_N() and missed hook_uninstall()
Comment #4
fgmI was keeping the uninstall for another issue to avoid mixing questions ;-). Good catch for the update_N, though. But we're missing use of the variable in the install hooks.
But since you've added the uninstall hook, it raises another question: should the collection be dropped on uninstall, as modules do with SQL tables ? Rerolled accordingly to drop the watchdog collection as well as the spurious watchdog_even_
collections for those running without the needed patch.Comment #5
fgmRerolled, there was a skipped typo in the original patch.
Comment #6
fgmRerolled:
- watchdog_event collections have a hardcoded watchdog_event_* name, not dependent on the name of the watchdog collection.
- include collection dropping on uninstall
Comment #7
andypostBig +1 to dropping data on uninstall. the only regexp confused me (probably because of late night)
I think this good to go but I need to test install-uninstall to confirm
Looks fine, but having test for this is best. Regexp should have comment to function that generates collection name to follow a changes that can happen in future in collection generation/
Also droping of data on uninstall is right choice that been missed.
Do we actually need this?
Great catch - hardcoded collection name and optimization.
Powered by Dreditor.
Comment #8
andypostlooks like most of this patch already commited
Comment #9
misc commentedI mark this as fixed. Most of the code seems to be in dev.