Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The only time I ever use them is to re-run updates when I'm patching and do a syntax error.
http://drupal.org/node/285992#comment-932715 says it all.
Comment | File | Size | Author |
---|---|---|---|
#51 | pending_updates_fix.patch | 551 bytes | maartenvg |
#43 | update_op_fix.patch | 486 bytes | swentel |
#21 | mw.patch | 6.07 KB | moshe weitzman |
#21 | Picture 1.png | 31.57 KB | moshe weitzman |
#17 | Picture.png | 94.35 KB | moshe weitzman |
Comments
Comment #1
JohnAlbinUgh, the experience in that comment is horrifying. And, although the poster is not particularly… endearing, I can imagine a more lovable newbie making the same mistake in the update.php form.
Ok, so I was pontificating on a solution. IMO, the only people that need to get at the version pull-downs are developers. Maybe the solution is to make the “Select versions” fieldset hidden unless a
dev_update_version
variable is set to TRUE. Then we can delegate the switching of that var to contrib (like devel.module).Or maybe just skip the whole
update.php?op=selection
page ifdev_update_version == FALSE
.Comment #2
catchIf we hide that fieldset, then iirc there's nothing else to do on that page, so it'd probably make sense to skip it entirely.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedOne problem with update.php is that there is no unupdate.php. One of the more common things I've noticed users trying to do is revert an upgrade change they've made. It would be good if update.php were able to capture the changes and a process be built assist in the reversion.
I agree that the update.php UI is ugly and confusing. What exactly should I be choosing? Why do I need to choose anything; the update system already knows what should be updated. Rather than a select box for each module a list of modules that will be upgraded is all that should be displayed with a button to continue with the update.
Why should a developer want to choose the update version? I understand the developer wants to test and retest the changes. If the idea of a reversion process is created then the developer could just revert the changes made to retest. Else, backup and restore the database to retest, which is what has to happen anyway.
Also, to help prevent updates without backups, a checkbox that declares 'Backup of the database has been completed.' so that the idiots think twice about updating without one. At least we would be able to say that the user was properly warned. He had to verify the action had taken place.
I'm making this a critical issue just because of the user experience factor.
Comment #4
catchIf we can remove the dropdowns entirely, that'd be pretty nice. devel can't really help us on update.php though - it's not going to be loaded - but you can set schema versions in system.module to arbitrary numbers to accomplish the same thing.
I think a checkbox is also a good idea, this could go on the first update screen - so if we go with JohnAlbin's suggestion of killing op=selection, the workflow would be:
browse to update.php
read text
click checkbox saying you've done a backup
submit
update.php batch runs
done.
completely missing op=selection.
One issue with major version updates, is that you get updates which run as soon as you land on update.php with no way to back out - so giving people a checkbox would currently be quite a bit too late for that. I once upgraded a (fortunately small and run by me) site to D6 by mistake, having copy/pasted my settings.php and forgetting to change the database to the backup copy. Of course I had the backup so it was OK, but still a bit hair raising since I'd never even got to op=selection before the database was foobar. It might be nice to have a pre-update.php page with just a notice and a checkbox for backups. Which then takes you update.php and the workflow above.
While a revert for updates would be clever, it's out of scope for this issue. The only thing I could imagine doing is copying all tables which are going to have updates run into backup_$timestamp_tablename - store that in a variable, and then a contrib module or external script which allows you to revert from those based on the timestamp. On large databases that'd be a killer though.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedA major version upgrade is a slightly different animal but I don't believe that anything should be upgraded just by merely entering the update.php path. All changes should wait for the user to press the continue button.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedI would *really* like to keep the selection step, but it could just be a list of modules that require update with checkboxes. This way you could skip modules you don't want to update yet.
Also, I'm not very fond of the "add a checkbox for idiots" idea. I don't think that being "Idiot-friendly" should be a design goal, especially when it's at the cost of bothering everyone else.
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedOh, and I don't really understand why this is marked as 'critical'. Since when every issue that has a "user experience factor" (meaning, more or less *every* issue) should be critical?
This is an important thing to solve, but there is no rush and we can safely discuss it and try several ideas.
Comment #8
catchI pretty much agree with Damien in #6. Checkboxes for modules to replace the drop-down are handy - I've seen upgraded paths where you need to do things in a certain order for example.
The two functions in D5 -> 6 which ran on update.php as soon as you hit it were: update_create_batch_table() and update_fix_d6_requirements() - we may not have anything like that in D7, but you never know. batch is obvious (and creation of a table is harmless enough an upgrade) - I think update_fix_d6_requirements was to suppress mysql errors on the minimal update.php bootstrap. Those two functions in particular will be removed if #278592: Sync 6.x extra updates with HEAD goes in - then we'll have a clean slate in update.php for any new D7 patches.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedEveryone being bothered once an update isn't as much of a bother as an idiot screwing up his system and throwing javelins at Drupal. This type of idiot friendliness is what we need.
Comment #10
drummMoving the dropdowns to devel module would be great. The update system does fully load modules so .install files can use all of the module's functions. If the continue button on the first page were a full form, devel.module can alter it. This would remove the selection page.
In an ideal world, we would not be asking users if they made a backup, we would be giving them a backup to download or automatically storing one on the server. But that is another issue.
We should provide better information about what will be updated. The first page should list what modules have updates, and maybe how many updates will be run for each theme. Checkboxes do not make sense, users should always update everything, anything else would leave you with a broken site.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedI agree with drumm except for a minor disagreement that "everyone should update all at once.". Your site might be broken if you go in stages. But thats OK if you are just planning on running one update after another. Running updates one at a time helps isolate problems. Anyway, removing a page is a big win.
Comment #12
drummIf there are checkboxes, then the update finished page would need to facilitate completing the upgrade. Remember, if we do offer checkboxes, we are asking people of all skill levels to understand what they do and how to use them.
General users should be able to simply update without needing to make any choices and the update should just work. This is dependent on module writers making updates that work.
More detailed error messages for reporting bugs and debugging would help with isolating bugs, with or without checkboxes. If the UI and underlying update code are good enough, then the checkboxes are not needed.
Comment #13
moshe weitzman CreditAttribution: moshe weitzman commentedThere are lot of conflicting and good ideas in this thread. I've implemented a bunch of them. I consider this patch to be a step in the right direction, and not the ultimate solution. Those are for follow-up patches which I will submit, along with anyone else who cares to jump in.
Update
. No checkboxes - see drumm's fine comments above.Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedThis time, without another patch mixed in.
Comment #15
floretan CreditAttribution: floretan commentedsubscribe
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commentedWell, that was easy. I am now showing update descriptions for all pending updates. The descriptions are automatically derived from the Doxygen for each update function. I think this is our very best chance at getting developers to bother with descriptions. This is low a level of effort as we can get. We also benefit in that we automatically get descriptions for all past updates for free. This is how we have always documented updates.
Comment #17
moshe weitzman CreditAttribution: moshe weitzman commentedHere is a screenshot. In order to duplicate this on your system, temporarily edit the record for system.module in the system table so its schema_version reads 7000. Then browse to the selection page.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedNice picture. Should the module name "system module" in the picture be a fieldset? With a #collapsed => TRUE?
Comment #19
Dries CreditAttribution: Dries commentedI think this is a significant improvement. Not everyone will want to see all the techno lingo though. I would support to hide these details by default, but to allow people to see them if they choose to. It looks like a fieldset is in order.
Also note that the last line of your patch has a 'AAUse' which looks like a typo.
Comment #20
chx CreditAttribution: chx commentedOne, awesome usage of PHP5 with reflectionfunction. I wonder whether API module needs to open in that direction
Two, agreed with Dries, hide them in a collapsible fiedlset
Three, @Dries the error is on your end, there are not even two adjacent a letters in the patch.
Comment #21
moshe weitzman CreditAttribution: moshe weitzman commentedNow using collapsible fieldset, with indication of how many updates lie within. I also renamed the step to 'Review updates' instead of 'Select updates'. Finally, I changed the button text to 'Apply pending updates' and removed redundant help text as a result.
The 'AA' string was in the last screenshot but not in the patch. I attach a new screenshot. I set to RTBC based on Dries' and chx reviews.
@chx - i mentioned reflection to drumm for api.module a long time ago and he rightfully said that api.module can't use reflection because it would have to load untrusted code as PHP. It currently avoids that with its regex strategy.
Comment #22
Pasqualleone collapsible fieldset per module (or package?) would look nicer than one huge fieldset..
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedRE: #22
Yes, please, that is what I meant in #18. One collapsible fieldset per module. But only if the module has updates.
Comment #24
moshe weitzman CreditAttribution: moshe weitzman commentedIf we are trying to simplify the page for the admin that does not care about technobabble, then one fieldset is best. If the committers want multiple fieldsets, I will implement that.
Comment #25
drumm(off-topic, @chx if we have our own parser we can also more-easily parse CSS and JS. However, it does need an overhaul, which I have been thinking about.)
I am traveling and have not had a chance to fully review this. I would like to point out that a fieldset is not necessarily the best UI element to use, since there are no fields in it. But it is the best we have now, and it should be used.
This patch is a good first step to streamlining our update UI.
Comment #26
catchQuick +1 for a single fieldset - I want an overview of what's going to happen for that page, not have to click > 5 fieldsets to see what's going to run - the dropdowns allow for such an overview (however opaque) now, so it'd be a shame to add extra clicks when we're trying to simplify it. Reviewed and tested the patch. I agree with leaving this at RTBC.
Comment #27
Dries CreditAttribution: Dries commented+1 for a single fieldset. The only thing I don't like about this patch is that the descriptions come from the Doxygen comments. Both serve two different purposes, IMO. It restricts how we can use Doxygen comments in the code.
Comment #28
drummI originally removed hook_update_info() to make development easier. There is no good reason to make developers list a bunch of functions when you can simply define the functions. That did require sacrificing the descriptions.
Hopefully, updates just work and there are good release notes. I think reading well-written release notes would be more useful than potentially-technical descriptions of individual database updates.
Comment #29
catchSo should we remove the descriptions entirely? Or maybe put a $verbose_updates flag in settings.php next to the access check? Seems like this needs some more review either way. I'd personally find it handy to have the doxygen for updates there, but equally can just look at _update_n() directly. I don't think we'll ever have anything other than technical descriptions for updates though.
Comment #30
drummI would certainly not make this an option. Figure out the UI and stick with it. (Developers can have additional UI for debugging.)
Comment #31
catchReviewed this again, putting them in a fieldset is hiding them plenty. I don't think the descriptions can do any harm at all, and they're definitely seful for some users (and much, much more informative than anonymous numbers). Patch still applies cleanly so marking back to RTBC.
Comment #32
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD.
Comment #33
xmacinfoWell, sometimes (although very seldom) a end-user need to update again an update that Drupal thinks it did correctly. It happened to me twice. So using the update.php and being able to re apply an update to the database saved my day. This occured using Drupal 4.7.x, though.
So, with Drupal 7, can we always be sure that an update was made properly? If yes, indeed showing drop down numbers can be confusing. But if Drupal 7 cannot guarantee that an update has been properly applied, then we still need a way for the end-user to re apply an update.
Comment #34
stewsnoozesubscribe
Comment #35
catch@xmacinfo - if an update isn't being applied properly, then it's a bug in the update function - so more an issue of backups and bug reports than the UI. If developers need to do this, they can hack the schema version in {system}, so as a last ditch that works I think.
Comment #36
webchickWell, there's definitely another issue that updates ought not to flag as completed unless they actually complete fully. Apparently this is difficult, though... I was talking to David Strauss and he said that Postgresql is the only database system that supports rollbacks on DDL (CREATE, DROP, ALTER, etc.).
I tried looking for an issue about this but can't seem to find one in 30 seconds. It'd be nice to have some sort of fallback procedure though (separate issue) with the addition of this code, so that Drupal doesn't ever skip running an update if there are problems. Maybe keeping track of what statements were already run and if there are SQL errors generated about the fact that they've already been performed, ignore them? Hm.
Comment #37
moshe weitzman CreditAttribution: moshe weitzman commented@webchick - this was a UI only patch. The old code also moved all modules to latest schema_version regardless of the value of the dropdown. So this patch made the UI consistent with the submit handling.
If we can't put DDL in a transaction, then perhaps we actually integrate an optional DB backup to the updater and then rollback if we detect a problem. Separate issue.
Comment #38
webchickRight. :) But I'm saying that this UI patch now makes it impossible to re-run updates if they fail (unless you have devel module, which most end-users do not), so we need to address that behaviour of skipping the number forward if there were failures during the update.
And yes, separate issue.
Comment #39
Anonymous (not verified) CreditAttribution: Anonymous commented@webchick: InnoDB also supports ROLLBACK operation if transactions have been set.
Comment #40
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedRANT: With all these fancy unit tests, apparently nobody tests patches by running the code anymore.
This patch breaks updates, try to add
function system_update_7011() {
$ret = array();
return $ret;
}
to system.install and observe.
Comment #41
moshe weitzman CreditAttribution: moshe weitzman commentedIf you want this fixed, it would be helpful to post an actual error message. I'm not going to try out "experiments".
Comment #42
Gerhard Killesreiter CreditAttribution: Gerhard Killesreiter commentedThere was no helpful error message unfortunately, otherwise I'd have dug deeper. Just WSOD.
Refusing to try out a rather simple test case is rather annoying.
Comment #43
swentel CreditAttribution: swentel commentedFunny one: the value of the submit button was changed to 'Apply pending updates'. That's why the $op in the switch case did not reach 'Update'. Attached patch changes the case.
Comment #44
swentel CreditAttribution: swentel commentedchanging status
Comment #45
webchickShould that be wrapped in st()?
Comment #46
Anonymous (not verified) CreditAttribution: Anonymous commentedI verify the patch works as expected and would RTBC but for
Karen'sAngie's question.EDIT: Sorry about the wrong name.
Comment #47
moshe weitzman CreditAttribution: moshe weitzman commented@webchick - none of update.ph is wrapped in st() or t() and thats deliberate - see the change history if curious.
Comment #48
webchickOk then!
Simple enough change; committed.
Comment #49
pwolanin CreditAttribution: pwolanin commentedSince this patch has gone in people report that no new updates are running.
Comment #50
pwolanin CreditAttribution: pwolanin commentedIt seems that updates from other modules do not get found or scheduled to run unless system module has an update.
Comment #51
maartenvg CreditAttribution: maartenvg commentedI'm sorry to bump this issue again, but this patch broke updates that are not in system.install. In other words update.php no longer performs modulename_update_N() for modules when system has no updates.
Attached is a small patch, but please review it thoroughly, specifically Moshe since he is the original author, and he might be able to explain why this was implemented in this way.
The problem lies in the lines around 259:
count($form) always is 1, because of how $form is built (everything goes into $form['start']). Therefore, if there are no updates in system.install $form['start']['system'] == array() will always be true as well (because of row 215), and thus the system will claim that there are no updates to be run, despite pending updates for other modules.
I've fixed this by using the $all array, which contains all pending updates. If it is empty, there are no updates to perform, otherwise there are.
BTW, it seems we need (more) testing for the update.php.
Comment #52
Anonymous (not verified) CreditAttribution: Anonymous commentedThis fix works.
Comment #53
moshe weitzman CreditAttribution: moshe weitzman commentedthe patch looks quite a bit more sensible than what i did. sorry about that. RTBC indeed.
Comment #54
webchickCommitted. Hopefully this is actually fixed now. :D
Comment #55
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #56
moshe weitzman CreditAttribution: moshe weitzman commentedI added this to the upgrade docs.