I'm on the phone a lot lately and need some kind of brain-dead, yet soothing patches that I can do while I'm listening. ;) Here's one I thought of today.
When one opens up an .install file, it's typical that one is doing so to read something about the database structure for that module. Either because they're interested in a field description, or they want to copy/paste the field definition from something in core.
However, because hook_schema() was added well after others like hook_install() and such, it often ends up at the very bottom of the files, causing said developers needless scrolling. Furthermore, hook_install() doesn't really do much nowdays; in most modules it's just a drupal_install_schema() call. So there's no reason for that to be at the top.
So I propose the following:
Go through every .install file in core and format it as follows:
1. Make sure there's a @file line at the top, that says "Installation file for Module module." (aggregator.install, for one, is missing this.)
2. Put hook_schema() first.
3. Followed by hook_requirements().
4. Followed by hook_install().
5. Then, hook_uninstall().
6. And finally, the big glop of all hook_update_N() functions.
7. Make sure that there are nice @defgroups between core versions for each update_N function, like there are in system.install.
Sound good?
Comments
Comment #1
deekayen commentedComment #2
lilou commentedPoint 1 is pending here : #320011: Add doxygen @file for all .install
Comment #3
deekayen commentedI'm in a mood to work on this, so I'll just leave out @file part.
Comment #4
deekayen commentedI added a couple defgroups and moved hooks around.
Comment #5
lilou commentedI mark issue #320011: Add doxygen @file for all .install as duplicated.
Comment #7
lilou commentedAdd tag.
Comment #8
deekayen commentedComment #9
sun@webchick: Less phone calls, less crazy ideas. :P
To get this done, I'd propose to do one file at a time. Equaling: One phone call of webchick.
Comment #10
sun.
Comment #11
wretched sinner - saved by grace commentedI'll try to look into this over the next couple of days
Comment #12
wretched sinner - saved by grace commentedOk. From running through the files:
color_requirements)install()oruninstall()install()oruninstall()I will attach individual patches - I can't attach multiple files to one comment!
Comment #13
wretched sinner - saved by grace commentedBlog API module
Comment #14
wretched sinner - saved by grace commentedBook Module
Comment #15
wretched sinner - saved by grace commentedComment Module
Comment #16
wretched sinner - saved by grace commentedContact Module
Comment #17
wretched sinner - saved by grace commentedDB Log Module
Comment #18
wretched sinner - saved by grace commentedField Module
Comment #19
wretched sinner - saved by grace commentedField SQL Storage Module
Comment #20
wretched sinner - saved by grace commentedForum Module
Comment #21
wretched sinner - saved by grace commentedLocale Module
Comment #22
wretched sinner - saved by grace commentedMenu Module
Comment #23
wretched sinner - saved by grace commentedOpen ID Module
Comment #24
wretched sinner - saved by grace commentedPoll Module
Comment #25
wretched sinner - saved by grace commentedProfile Module
Comment #26
wretched sinner - saved by grace commentedSearch Module
Comment #27
wretched sinner - saved by grace commentedSimpleTest Module
Comment #28
wretched sinner - saved by grace commentedStatistics Module
Comment #29
wretched sinner - saved by grace commentedSystem Module
Comment #30
wretched sinner - saved by grace commentedTaxonomy Module
Comment #31
wretched sinner - saved by grace commentedTrigger Module
Comment #32
wretched sinner - saved by grace commentedUpdate Module
Comment #33
wretched sinner - saved by grace commentedUpload Module
Comment #34
wretched sinner - saved by grace commentedYe Grand Olde Massive rollup patch. Includes all my patches above, plus suns patch to Aggregator in #9
Comment #35
sunWooohooo! :)
@wretched sinner: Unfortunately, there is one thing missing in your patches - the leading @file and the @ingroup PHPDoc statements (both and after a set of updates - have a look at my Aggregator patch to see what I mean).
Another important thing is that we also want to move hook_requirements from the .module into the .install file, if existent.
@webchick: By the way, what about hook_enable()/_disable() ?
Comment #36
lilou commented@sun patch : don't change @file description in aggregator module (see #320011: Add doxygen @file for all .install, http://drupal.org/node/224333#afile and coding standard)
Comment #37
wretched sinner - saved by grace commentedIf webchick can chime in on whether we want to have the
hook_enable()andhook_disable()merged in, then I will look to re-roll with the comments above.Comment #38
wretched sinner - saved by grace commentedComment #39
sunThere are several other issues in the queue that tackle this now: http://drupal.org/project/issues/search/drupal?issue_tags=coding%20stand...