In the documentation for hook_update_N(), the parameter $sandbox is not documented (reported by flaviovs).

Comments

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev

I wouldn't exactly say it's not documented. The function doc says:

If your update task is potentially time-consuming, you'll need to implement a multipass update to avoid PHP timeouts. Multipass updates use the $sandbox parameter provided by the batch API (normally, $context['sandbox']) to store information between successive calls, and the $sandbox['#finished'] value to provide feedback regarding completion level.

This is missing from the Drupal 6 doc though, and should be added.

avpaderno’s picture

What I mean is that the documentation is missing the section Parameters that is present, e.g., in hook_view().

jhodgdon’s picture

Version: 6.x-dev » 7.x-dev

OK. Someone can add an @param and say something like "see above". Should be done in D7 first. Then D6 needs the @param as well as the section quoted above that exists in D7 and is missing in D6.

jhodgdon’s picture

Title: The parameter &$sandbox is not documented » The parameter &$sandbox is not documented in hook_update_N
Issue tags: +Novice

Good project for a novice doc contributor

chrisparsons’s picture

Assigned: Unassigned » chrisparsons
chrisparsons’s picture

Status: Active » Needs review
StatusFileSize
new645 bytes

Added documentation for @param $sandbox.

Status: Needs review » Needs work
Issue tags: -Novice

The last submitted patch, 937560-6.patch, failed testing.

chrisparsons’s picture

Status: Needs work » Needs review
Issue tags: +Novice

#6: 937560-6.patch queued for re-testing.

jhodgdon’s picture

Status: Needs review » Needs work

Hmm. How about "Stores information for multi-pass updates. See above for more information." or something slightly more illuminating?

Also, it looks like the test bot was randomly failing. If that is systemic (e.g. if it's always failing on a particular test), we might have an issue somewhere else in Drupal. We just fixed one of these over the weekend (a filter.test failure). So net time you queue for retesting, maybe you could also put a link in to the failed test results, so we can investigate? i.e. the URL linked to in "View details" in the testing line.

Thanks!

chrisparsons’s picture

Assigned: chrisparsons » Unassigned
Status: Needs work » Needs review
StatusFileSize
new708 bytes

I messed around with it a little bit, but kept coming back to your wording jhodgdon. Patch attached.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

avpaderno’s picture

Status: Fixed » Patch (to be ported)

The patch should be ported to D6.

jhodgdon’s picture

Right. See #3 above for what needs to be done. Thanks for remembering to set the status to "to be ported", kiamlaluno...

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev

Version wasn't changed. :)

albert volkman’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new694 bytes

D6 backport attached.

Status: Needs review » Needs work

The last submitted patch, 937560-d6-16.patch, failed testing.

jhodgdon’s picture

Ignore the test failure. The hook docs files are in the Documentation project, not the Drupal project, in D6. I'll see about applying it to Drupal 6 shortly. Thanks!

jhodgdon’s picture

This patch applies fine to the Drupal 6 documentation, but it isn't quite enough. In D7/8, the page tells what a "sandbox" is before you get to the @param $sandbox. But the D6 documentation does not have this information. So that needs to be ported from the D7/8 docs before we can say " See above for more information."
http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

albert volkman’s picture

StatusFileSize
new1.16 KB

Ah, I should have read it closer. Updated.

jhodgdon’s picture

That's better! This one line needs to be shortened to less than 80 characters though:

+ *
+ * See the batch operations page for more information on how to use the batch API: http://drupal.org/node/180528
+ *
albert volkman’s picture

StatusFileSize
new1.17 KB

Fixed!

jhodgdon’s picture

Status: Needs work » Fixed

That looks better. I've committed it to the Documentation project. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Novice

Automatically closed -- issue fixed for 2 weeks with no activity.