This is a follow up to #394268: DIE update_sql() DIE!
Now that update hooks have a new API (see previous issue), we have some follow up work to do. webchick already said this is safe to do during code slush as it's a continuation of an active issue, but we should still do it quickly.
1) Update all core update hooks to the new API. (Do nothing on success, return translated message on success, use $sandbox parameter for batch operations, throw an exception in case of error.)
2) Update Schema API to remove the stupid $ret array that serves no useful purpose anymore. This is an API change to the DB classes and to the wrapping functions. It also means that the schema classes can just call $this->connection->query() directly and do not need to use update_sql() anymore.
3) Delete update_sql() entirely.
I'll look into this after I get back from vacation if someone doesn't beat me to it. :-) webchick said she wanted it all in one patch, but I am also open to a multi-step process if it makes things easier.
Comment | File | Size | Author |
---|---|---|---|
#24 | zombie_ret.patch | 4.22 KB | Crell |
#22 | zombie_ret.patch | 3.77 KB | Crell |
#15 | death_to_ret.patch | 134.32 KB | Crell |
#12 | death_to_ret.patch | 135.66 KB | Crell |
#6 | death_to_ret.patch | 129.48 KB | Crell |
Comments
Comment #1
yched CreditAttribution: yched commentedOops, just created #570910: Return meaningful messages from update hooks for 1)
Comment #2
Crell CreditAttribution: Crell commentedOK, I hope to God this works. :-) This is the all-in-one patch. $ret is gone. update_sql() is gone. All update hooks in core should be updated. While I was at it I also converted a lot of single-inserts to multi-inserts, since we didn't have to use update_sql() anymore.
I'm not removing the BC parts of the update system yet. Convert stuff first. This patch is huge enough as is. It's also probably very fragile. Please review soon so that it doesn't break and force me to redo it. :-)
Comment #4
Crell CreditAttribution: Crell commentedLet's try to get them all this time...
Comment #6
Crell CreditAttribution: Crell commentedOK, $ret, you and me, behind the gym after school. You're goin' down, boy...
Comment #8
Crell CreditAttribution: Crell commentedOK, I give, I cannot replicate these exceptions. Those tests run perfectly on my system. Anyone want to help here?
Comment #9
asimmonds CreditAttribution: asimmonds commentedThe update field tests are attempting to pass array() to db_drop_table().
field_sql_storage_field_storage_update_field() still has a couple of db_ function calls with $ret.
Comment #10
Crell CreditAttribution: Crell commentedHuh? Where? I don't even see such a function. Got line numbers?
Comment #11
asimmonds CreditAttribution: asimmonds commentedfield_sql_storage_field_storage_update_field() was recently added in this commit: http://drupal.org/cvs?commit=267832 to modules/field/modules/field_sql_storage/field_sql_storage.module
Can't update the patch from here (firewall restriction), but the changes for field_sql_storage_field_storage_update_field() are:
Comment #12
Crell CreditAttribution: Crell commentedFigures, that patch was committed *as I was working on this one*. Fail!
Let's try this one now...
Comment #13
chx CreditAttribution: chx commentedquick, someone commit this before it breaks :D
Comment #14
webchickI really want to commit this, but unfortunately the system.install hunk no longer applies. :( I can haz reroll?
Comment #15
Crell CreditAttribution: Crell commentedWould you people please stop committing things while I am writing gigantic patches?
I have no idea what was wrong with the last patch, but here it is again. Probably whitespace somewhere the broke stuff. Yar.
Bot, you like?
Comment #16
Dries CreditAttribution: Dries commentedLooks good -- less is more. Committed to CVS HEAD. Thanks!
Comment #18
Crell CreditAttribution: Crell commentedThis has been documented. Just sayin'.
Comment #19
hass CreditAttribution: hass commentedIn past we haven't used
t()
in hook_update for the simple reason that translatable strings are not yet imported while running the update hooks and therefore never shown translated. Anything changed about this behaviour?Comment #20
yched CreditAttribution: yched commentedIs there a reason why system_update_N() all still have '$ret's all over the place ?
Comment #21
Crell CreditAttribution: Crell commentedHm. That's a really good question. It looks like they're all in 60xx update hooks. I know I did a find for "$ret =" in all of Drupal when rolling the patch above and killed them all, even those not in update hooks just to be sure. There's even some update_sql() calls in there! Did someone add back in old update hooks or something? I know I'm not THAT oblivious...
Looks like we've still got some cleanup to do. *sigh*
Comment #22
Crell CreditAttribution: Crell commentedIt looks like what happened is someone forward-ported the updates added to Drupal 6 post-6.0's release, and didn't update them for the changes to the update API. This should take care of it.
It also removes the BC code from update.inc that we don't need anymore.
Comment #24
Crell CreditAttribution: Crell commentedGrumble grumble grumble.
Comment #25
yched CreditAttribution: yched commentedChanges look good. Besides deleting the strict-BC code in update_do_one, we could also rework the rest of the function that is still globally designed around the old format.
Not critical, though.
Comment #26
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!