For multipass operations, the batch API provides the notion of 'sandbox', which is a safer way of storing persistent data than $_SESSION.
Current HEAD contains 2 multipass updates, both of which still use the 'old' $_SESSION system :
system_update_6021 (Migrate the menu items from the old menu system to the new {menu_links} table)
book_update_6000 (Migrate the existing book hierarchy into the new {book} / {menu_links} structure)
Attached patch changes them to use the new batch API $sandbox. Not critical, obviously (using $_SESSION is less problematic during updates since sensible admins probably avoid browsing their site while an update is running in another tab...), but would be good for educational purposes - eat your own dogfood, that kind of thing...
Side note :
For 'classic' batch operations, the use of $context['sandbox'] is documented in the PHPdoc for batch_set(). The way this translates to multipass update functions (by-reference $sandbox argument), though, is only documented in batch_example.module : http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/exam...
I couldn't find any relevant place in core doc.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | multipass_update_0.patch | 13.43 KB | yched |
| #1 | multipass_update.patch | 13.42 KB | yched |
| multipass_update.patch | 13.17 KB | yched |
Comments
Comment #1
yched commentedOops, previous patch missed one replacement.
Comment #2
yched commentedRerolled
Comment #3
pwolanin commentedsubscribe
Comment #4
pwolanin commentedI see some minor bug fixes too in the book update (0 vs. FALSE)
Comment #5
samhassell commentedsubscribe - this is causing quite a few people to lose their book.module structures when running Drush updates.
http://drupal.org/node/467770
http://drupal.org/node/667298
Comment #6
aren cambre commentedSubscribing also because of Drush updates issue.
Comment #7
aren cambre commentedI think this should be critical if we want to consider Drush a serious part of Drupal. This code is causing Drush to mess up navigation, and it is critical for any web content manager to not screw up navigation.
Comment #8
asb commentedComing from #467770: Book structure disappears repeatedly...
wtf... last patch is three years old? The patch from #2 is against HEAD from December 19, 2007 - what's the status of this isse?
Comment #9
iss commentedsubscribing due to drush update
Comment #10
yched commented"wtf... last patch is three years old?"
2 years old, actually.
It was posted when polishing D5 -> D6 upgrade path, at the end of the D6 dev cycle. Back then, it was only a cosmetic change converting updates functions that were written before batch API landed in D6, and let them use the new batch API syntax for persistency in multipass updates ($sandbox), instead of the 'old' D5 way (based on $_SESSION).
Drush has landed since then, and what was only 'old-style but working' code is now broken with drush, since CLI doesn't have sessions.
If people have come here these last few days and reported that the patch fixed their D5->D6 drush upgrade, then I guess it still applies and is ready. Needs someone to push the RTBC button. Not me, I wrote the patch :-).
Comment #11
samhassell commentedhrmm.
against drupal-6.15 cvs the system.module patches are failing:
So I removed them and the book patches run fine.
Unfortunately 'drush up' still wipes the book structure :(
Comment #12
samhassell commentedI removed the book_update_6000() function altogether and drush up still kills the menu structure so I guess we are barking up the wrong tree here, at least to some degree.
Comment #13
aren cambre commentedSo it's time to unset #667298: drush update destroys menu_links table entries for book as duplicate?
Comment #14
seanberto commentedsubscribing
Comment #15
quentinsf commentedsubscribing
Comment #16
Magnity commentedSubscribe
Comment #17
gilf commentedSubscribe
Comment #18
joel_guesclin commentedI do not think this is to do with drush - I have same problem after ordinary upgrade
Comment #19
aren cambre commentedJoel: you're right, it doesn't. Drush has independently fixed its own bug.
Comment #20
joel_guesclin commentedCould it be anything to do to do with this?
Comment #21
bjorpe commentedSubscribing - book upgrade problems is a serious showstopper when moving from D5 to D6
edit: is this really solving the problem with book update that people are experiencing? From the description in the original post it seems unlikely to me.
Comment #22
nancydruI upgraded books from 5 to 6, but I believe it was before the menu changes in 6.2.
Comment #23
dpearcefl commentedIs this issue fixed in the latest D6? is there any interest in pursuing this issue?
Comment #24
dpearcefl commented