Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2009 at 12:31 UTC
Updated:
17 Jan 2016 at 03:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedThis NULL default value for $sandbox is not needed anyway, there will always be a $sandbox passed in.
Should be fixed in D7 first, then backported - even though it's not an actual bug in D7 since we require PHP5, but it's a doc inaccuracy.
Trivial fix, setting straight to RTBC.
Comment #2
avpadernoAre the files in /cvs/drupal-contrib/contributions/docs still used, or should they be considered obsolete?
I thought that it should be enough to change those files, but the patch is against a different file.
Comment #3
avpadernoI am correcting the title, which repeated the word .
Comment #4
yched commentedre #4: In D7 hooks documentation is included in core files.
I updated contributions/docs/developer/hooks/install.php for D6
Comment #5
webchickHm. I actually find the proposed patch makes the documentation less clear. $something = NULL is a universal way of communicating that a function parameter is optional. That you have to explicitly spell it out in inline comments below that indicates that we're doing something funny and non-standard.
I lean towards won't fix on this for D7. What am I missing?
Comment #6
yched commentedWell,
[mymodule]_update_xxx()is the basic, well known form of most update functions (the ones that are not multipass), and you find this form in all of core and contrib. Browsing through .install files, it's also a good way to recognize which ones are multistep or not.It seems strange that the doc should say different and that we start to see
[mymodule]_update_xxx(&$sandbox = NULL)for non-multipass updates flourish in contrib.Besides, the incoming $sandbox param is *never* NULL, it's just that it can and should be overlooked by 'simple' update funcs. So I'm not even sure the current doc is accurate.
Comment #7
avpadernoThe problem was more with Drupal 6, which is compatible with PHP 4; if I would use the parameter as declared in the documentation, I would get an error message.
In Drupal 7, the problem doesn't exist anymore.
As webchick already said, using a default value in a function declaration documents that the parameter is optional, and therefore I don't need to use it.
If the default value would not be used, I would get I always need to declare it, which is not true.
Comment #8
yched commented... in the sense of "the caller might not provide the argument". This is not the case here. The doc is wrong and misleading even for D7.
Comment #9
webchickHm. Ok. Well then let's at least move this documentation up into the @param stuff in the PHPDoc rather than in the function body where no one will read it.
Comment #10
dries commentedCommitted to CVS HEAD.
Comment #11
yched commentedre webchick #9: Fair enough. That doc needed an overhaul anyway. What about that one ?
Side note: I removed any reference of the batch API. The update 'engine' internally relies on batch API, but update authors should not really have to bother with this IMO.
Comment #12
hefox commentedPatch applies cleanly and everything makes sense
Not part of the patch, but part of the documentation, should the text after @endlink be wrapped?
Currently:
e.g the contributions branches and tags.
Comment #13
jhodgdonCan we change the first line to something a bit more descriptive than "Perform a single update."? What kind of update?
Also, why is the 2nd paragraph suddenly mentioning "patches", and grammatically, the "which" there needs a comma before it.
Next section:
This should say "Numbering for update functions consist..." instead of "Database updates consist"
Also, can we take "simply" out of all of the code comments in the hook function body?
Comment #14
jhodgdonOne more thing:
That comment does not follow Drupal coding standards, and also "subtract" is misspelled.
Comment #15
jhodgdonReviving this issue... Patch needs a reroll for sure, and issues mentioned above need to be fixed. Also it may not conform to current docs coding standards.
Comment #16
jhodgdon#11: system_hook_update_N.patch queued for re-testing.
Comment #18
albert volkman commentedRe-roll, issues addressed, spelling fixed. Some issues have already been resolved e.g. #1619482: hook_update_n() docs should explain magic with docblock text being used inUI
Comment #20
albert volkman commentedD'oh.
Comment #21
jhodgdonThanks for the new patch(es)!
A few thoughts:
a) I don't think I like the first line change. Some update update hooks do database updates, and some do other types of updates. I also don't think we need "module-related", since for instance some core updates in system.install are not related to particular modules. [Ooops. Looking back I see that I requested the first line to be changed in comment #13... but anyway I still don't think this particular change is great.]
b) Why are we removing
? I think we should maybe leave that there, and maybe we should add a note to the $sandbox @param docs to omit the parameter entirely if you don't need it?
c)
Can we make a more realistic example here of a good message to return? Same with the exception.
d)
Let's follow our own docs standards. Comments should end with . not .... :)
Comment #22
jhodgdonWe did a lot of changes to the hook_update_N() docs for 8 a while back on another issue. At this point I think I'll just close this issue; if someone cares deeply about updating 7's docs feel free to reopen this really old issue and make a new patch for 7.