Problem/Motivation
There's some apparent inconsistency in API function names for working with modules, which makes them difficult to guess:
module_enable() and...
module_disable() but...
drupal_uninstall_modules()
Are there others?
The first two functions live in module.inc, and the last one lives in install.inc, which probably accounts for the difference—and I can understand that, but it's still confusing, and I wonder if it couldn't be different. Also, I wonder if there would be a convenient way to group the functions somehow in the API docs. Maybe that's silly, but I expected to be able to see all the functions for manipulating module status together.
Proposed resolution
Make the names consistent. :)
Remaining tasks
- Discuss and reach consensus.
- Write a patch. (I'll write a patch if a change is agreed-upon.)
API changes
To come.
Comments
Comment #1
traviscarden commentedRenaming per chx's foreboding prophecy of doom-bringing flame wars over the original title. ;)
Note: This issue is not about function prefixing or namespacing in Drupal in general. It is about three specific, related functions being named alike and nothing more.
Comment #2
Ethos commentedJust checking the ever exciting coding standards for you:
Does it fully comply with Drupal coding standards?
Clearly. In fact, it seems to bring these particular functions much closer to the consistency valued by drupal users. So not only does it comply, it actually improves :)
If the patch includes tests, are they both necessary and sufficient?
Not really applicable, but any test should be relatively simple to do, so a yes on this.
Does the patch actually solve the problem? Absolutely. in provides a clear, simple, and concise solution.
In conclusion, This should absolutely be implemented and should be supported by the community. Changed status to reviewed and tested.
Comment #3
tstoecklerRTBC means there is a working patch. Setting back to active.
That said, this totally makes sense.
In theory, the fact that they live in module.inc should provide such a grouping. De facto a lot of functions that should be in there aren't and vice-versa, so...
Comment #4
traviscarden commentedAdding tag.
Comment #5
webchickThis just bit me today and was really, really strange. I'd say go for it!
Marking as "Novice" since this should be a pretty easy patch to roll.
Comment #6
traviscarden commentedAwesome. Here's a patch. Moving the function into module.inc broke tests, so I left it where it was. If folks think it would be worth moving it and can enlighten me as to what would need to be done to make it work, I'd happily re-roll the patch. Thanks!
Comment #7
tstoecklerLooks good. Maybe you could upload a patch with the function moved, so we can see what tests break.
Maybe we can also just commit this as a first step, though. Hmm...
Comment #8
traviscarden commentedSure @tstoeckler. Here's a patch moving the function from install.inc to module.inc.
Comment #10
traviscarden commentedOh. module.inc just needed the
DatabaseStoragenamespace. That's easy enough. :) Here's an updated patch.Comment #11
tstoecklerThis is RTBC. Awesome!
Also tagging DX.
Comment #12
traviscarden commentedThanks, @tstoeckler.
Comment #13
webchickLove it! :D
Committed and pushed to 8.x. Thanks!
We need a change notice for this.
Comment #14
tstoecklerhttp://drupal.org/node/1675008
Comment #15
Tor Arne Thune commentedLooks good :)
Comment #16
sunThe use statement was added to module.inc but not removed from install.inc. :)
Comment #17
andypostSeem this namespace is not used in install.inc, what the bot say...
Comment #18
tstoecklerRTBC if it comes back green. Sorry for overlooking this.
Comment #19
dries commentedNice API clean-up. Let's wait and see if this turns green.
Comment #20
dries commentedCommitted to 8.x. Thanks.