Once upon a time, after plugin manager (what it was then called) finished updating your site to newer releases, if you had pending DB schema updates, it would run update.php for you.

In the final push to get something working and committed, we tried to make it so it at least shows you if you have DB updates to run, but it's currently broken. :(

Quoting webchick from #538660-154: Move update manager upgrade process into new authorize.php file (and make it actually work):

I got confused at the end because it said update was completed and it took me out of site maintenance mode, but yet still said I had updates remaining. A couple of things here:

1. Ideally, it would run update.php for me. (It did at one time, so I would consider this a bug fix follow-up)
2. If it doesn't, it should at least not take me out of site maitenance mode until I've done so myself.
3. It should only tell me about db updates if there actually are some (bug fix)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

While we're at it, let's use this issue to remember what alexanderpas pointed out at #538660-150: Move update manager upgrade process into new authorize.php file (and make it actually work):

+++ modules/update/update.authorize.inc
@@ -0,0 +1,302 @@
+      variable_set('site_offline', FALSE);

"we shoudn't turn online when we were already offline before we started the process."

webchick's #2 basically covers this, but I wanted to record it here so it doesn't get lost/forgotten. Basically, we shouldn't be setting the site online automatically at all. We should just present a landing page with a UI to control the site off/online state, and let admins choose what to do...

JacobSingh’s picture

I'm on the fence about giving a UI to turn your site on-line. I'm afraid people will hit update, and then go get coffee or not notice that we said "your site is offline until you do x".

dww’s picture

Well, at the *very* least we shouldn't put the site online unless they put it offline as part of the update workflow.

Better yet, if we detect DB updates, we say: "Yo, your new updated code has DB updates to run, leaving your site offline until you deal with that." Sorry, but "go get coffee" isn't an excuse. ;) What are they going to do with DB updates? What if something went wrong? If they miss all our help text and messages, then at least core is going to keep reminding them the site is offline on every page load until they put it back online again...

Ideally, we run try to run the missing DB updates somehow, and then give them a final landing page. Perhaps at that point if they put the site offline in the first place, and everything completed successfully, we can automatically but the site back online again...

dww’s picture

Priority: Normal » Critical

Actually, this is totally broken right now: e.g. it tells you you've got updates when you don't. Upgrading this to critical, since the update manager really doesn't work as intended and is likely to confuse and annoy site admins as long as this isn't fixed...

dww’s picture

Assigned: Unassigned » dww
Status: Active » Needs work
FileSize
2.85 KB

Ugh, while working on this, I ran into #683988: failure to clear the system_list entry from {cache_bootstrap} results in bogus results when you upgrade a module which makes it kind of hard to test this. :( But, here's a patch that *would* work if core actually looked for DB updates in the right place. At least this no longer tells you to run update.php for code updates that don't have DB schema updates to run. Instead of trying to figure this out separately for each module (which would require loading all of includes/install.inc during the batch in authorize.php, which I'd rather not do, plus, it's weird UI), we just do a single check for any missing DB updates on the authorize.php landing page. If this test actually worked, it would include the link to update.php and tell you to run it. ;)

We still don't properly handle the site offline stuff, but we're getting closer...

dww’s picture

Well, duh. ;) Of course #5 isn't going to work, regardless of the bugs in #683988: failure to clear the system_list entry from {cache_bootstrap} results in bogus results when you upgrade a module, since authorize.php is running at a very reduced bootstrap level. Tee hee. So, that module_list() call is just giving us 'system' and 'user'. ;)

We still need to solve #683988, which is a mess, but this also needs more thought... Good thing I submitted #5 as 'needs work' in the first place. ;)

dww’s picture

Grrr, even if we use module_list(TRUE) there to test all the enabled modules, since we still haven't done a full bootstrap, we're still doomed. drupal_get_schema_versions() continues to return FALSE, since no .install files are loaded. I honestly don't see any way to reconcile this functionality with the desire to keep authorize.php at a low bootstrap level so that the landing page doesn't completely blowup if a bogus install was executed. Not that authorize.php currently provides you any way to recover from such an error. :( Ugh.

dww’s picture

Stepping back, we have a few options here:

A) Just remove all reference to update.php, since we can't (yet) reliably tell you if you're missing updates or not.

B) Always have either a link (or perhaps even a "next" button) that takes you to update.php with some help text that explains why that's a good idea. In this case, we should probably add something to the landing page when update.php completes to let you take your site back online at that point...

C) Actually load all the .install files so we can accurately tell if you're missing updates and only conditionally do (A) or (B). This sucks since it means if the update includes busted code, we die as soon as we hit the landing page, and lots of effort has gone into trying to avoid that so far.

D) Do some wonky parsing of .install files without actually loading/eval'ing any of that code. Probably a lot of bloat for not much benefit.

Based on IRC chat, webchick and I are leaning towards (B) for now, since it's simple and at at least fixes the existing UI bugs in here. Attaching a screenie of the current landing page for comparison (probably belongs over at #602484: Fix the report page when authorize.php completes an update manager operation but whatever, here's fine for now).

dww’s picture

p.s. Oh, except I want to look at how update.php and update.inc handle this, since I think they manage to discover the pending updates without actually loading everything...

dww’s picture

re: #9: drat, nope. update.php does the full bootstrap eventually. update_get_update_list() is sort of what we want, except it's relying on all the .install files being loaded, since it's calling drupal_get_schema_versions()... So, there's no happy option E (yet) that magically does everything we want and doesn't suck.

dww’s picture

I'm not sure a "next" button is best, since the update.php landing page sort of starts over assuming you haven't done anything yet, and tells you to backup your code/db, take your site offline, etc. :( It's not really seamlessly integrated with the update manager workflow in an ideal way, which makes sense, since we need update.php to stand alone and work for sites using other code deployment tools like drush, etc.

So, here's a patch that at least removes the existing bogus handling of DB updates, and adds a generic "task" at the end. Simple patch and before/after screenshots. Note that the before screenshot is wrought with problems, even though it actually looks like it's doing what we want. It always displays that message for the alphabetically last module that was updated, regardless of if it's missing DB updates or not, and it clobbers the same messages from other modules that might actually have pending updates, etc. That stuff is all broken and needs to be fixed either at #602484: Fix the report page when authorize.php completes an update manager operation or #605292: propagate failure during batches in update manager.

Yes, this page is still terrible. We still desperately need a UI cleanup at #602484. But, this is an incremental step in the right direction, since at least we won't be lying about non-existant DB updates anymore.

Bojhan’s picture

Sorry, but this seems a bug that is worth fixing over choosing a bad alternative. Why are we sacrificing the good workflow, for no reason? I think its obvious that, update.php needs to be ran in case there are Database updates - unless specified otherwise.

So 1, from the initial post.

I totally do not see why webchick, prefers a bad workflow over a good one. Even given all the circumstances we should not sacrifice on this?

dww’s picture

Why are we sacrificing the good workflow, for no reason? ... Even given all the circumstances we should not sacrifice on this?

I tend to agree, except there are reasons (maybe not "good", but reasons):

- This is complicated to actually make it work on a technical level, without opening many cans of worms in how authorize.php and the update manager were built from the ground up (the fact that authorize.php doesn't load all of Drupal on purpose in case something is broken during the upgrade).

- This has been broken for months, and in spite of repeated attempts to solicit help working on it, no one's shown up to do anything about it.

- I couldn't personally plow through every possible update manager related issue on my own over the last few months, due to a combination of work and personal fires. It's rather miraculous how much I've managed to get done in this area, really.

- It's a few hours before the alpha1 release.

Given all that, in IRC last night we decided that something like #11 was the best we could hope for. If you can help make a compelling case that this is really a critical UI bug that needs to be fixed properly, such that either we delay alpha1 for it, or relax the string freeze in alpha2 for it, I'd be thrilled. But, I think you're going to have to be able to convince Dries directly of that. webchick's mind is clear on this...

Meanwhile, #602484: Fix the report page when authorize.php completes an update manager operation is still completely insane. It's not even valid HTML. ;) So, we *can* make some progress there if we had a clearer plan on exactly what we wanted that page to look like. Although, it really deeply depends on what we finally decide to do here. I'm a bit stuck on how to best proceed without feedback from Dries on what's possible and when.

I have to be mostly AFK for the next 5 hours or so. After that, I'll plow into these issues and hope for the best...

Thanks,
-Derek

Bojhan’s picture

I am going to be pretty strong here, but the Update Manager is useless without this issue beign fixed. I dont think we need to convince Dries or webchick of this, its pretty obvious that the idea of the propose of the newly introduced functionality is to allow beginners to install and update modules, if we take away a important step in this process - we are going to make it very less usefull.

I hope you can still produce a patch, without opening all the cans of worms :)

Dries’s picture

I'd be OK to go with option (b) from comment #8. The patch in #11 seems to do that, but it could use some design/UX love. In absence of a UX review, I'm happy to commit #11.

Bojhan’s picture

@Dries I gave it in #12 and #14 - I do not think its acceptable to have no indicators or no workflow that there are Database updates.

Providing a link that says "You should run the database update script in case there are new database updates." - which is basicly saying (are you feeling lucky); is not a workflow nor an indicator.

Because the first time people see that, they might click it - but I highly doubt they will the second or third time.

sun’s picture

Status: Needs review » Needs work

You should run the database update script in case there are new database updates.

Channeling yoroy: WTF? Drupal plays command & conquer on me again!

1) Remove the command.

2) Remove the subjunctive. The user doesn't know whether there are updates, so most probably there are some.

3) Remove repeating of "database updates".

4) Is this notice only output in case we replaced a module? Would it be possible to do so?

Either way, I suggest to re-phrase into:

"Run updates to migrate your data."

(completely as link)

sun’s picture

Status: Needs work » Needs review
FileSize
2.07 KB

Patch with suggested change.

JacobSingh’s picture

heh, what does 'migrate your data' mean. :)

What about

"Your modules have been downloaded and updated."
Next step: _Run database updates_

catch’s picture

Status: Needs review » Needs work

Agreed with #19.

Bojhan’s picture

Honestly, what is this solution? Can anyone provide a screenshot? Just changing the label is not what I meant, with their being a workflow issue.

catch’s picture

When you update a module, you should visit update.php anyway, because that does things like clear css and menu caches for you, so it should be a more or less compulsory step I think. However if that requires re-working too much at this point, then a strongly worded link / button is better than nothing.

bcn’s picture

Status: Needs work » Needs review
FileSize
2.04 KB

Reroll of #18 with wording changed per 19 & 20...

sun’s picture

Status: Needs review » Needs work
+++ modules/update/update.authorize.inc	1 Apr 2010 23:32:52 -0000
@@ -206,7 +208,11 @@
+  ¶

Trailing white-space here.

Powered by Dreditor.

bcn’s picture

Status: Needs work » Needs review
FileSize
2.04 KB

fix from #24.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Bojhan’s picture

Status: Fixed » Active

As much as I would love to agree, this is not fixed at all. Its merely a string change, that is not actually fixing the workflow issue at all. Also mentioned it in #16 and #21

redndahead’s picture

@Bojhan what is your idea of a solution? Are you saying that update.php should automatically run after the module updates?

Bojhan’s picture

Yes, or it should give notice that there are updates to be installed.

tstoeckler’s picture

Coming from #228860: Upgrading a module with a newly added dependencies breaks things badly I think the current solution is also not what we want.
We always want to run update.php. We could check if there are database updates required, but that only caters for 1 of 3 possible use-cases for running update.php:

  1. Database updates. Can be checked
  2. Newly added dependencies. Can be checked.
  3. Clearing caches.

So I think the easy way out is to tell the user to definitely run update.php (or just send him there directly?). The bonus level would be:
- Checking for database updates
- Checking for newly added dependencies
If one of them is TRUE go to update.php. Otherwise clear all caches and let the user be.

dww’s picture

Assigned: dww » Unassigned

I've already explained why "checking for database updates" is a very difficult problem on the final landing page of the update manager workflow on authorize.php after the code has been updated. Please (re)read comments #7 and #8 above. "Checking for newly added dependencies" is the same problem -- we'd have to load all the code we just updated to know if there are dependencies, which breaks authorize.php in case of a botched upgrade.

In terms of "always send them to update.php", when/how/where are we supposed to report the results of the code updates? If there's no final update manager landing page on authorize.php and we immediately redirect to update.php, either:

- We never provide any feedback to users about what happened with the code updates (ugh)

- We have to somehow carry around all that data and display it at the end of the update.php process

- When we first land on update.php, it prints you out the results from authorize.php and then asks you to click "continue" (or whatever) to begin the DB update process.

I don't see how the final option is much different than just adding a "Continue" button on the final authorize.php landing page that is really a link that takes you to start update.php, perhaps with something stashed in your session to remember that you're coming from update manager so that the welcome text doesn't tell you to do things you've already done (backup the DB, put site offline, etc).

I have no time in the near future to be working on this, so I'm unassigning myself. If someone wants to work on it, please knock yourselves out, but I can't drive this home right now. I'll just try to help answer questions and avoid wasted effort as people propose solutions and patches here.

Cheers,
-Derek

catch’s picture

I don't see what can be done here apart from a strongly worded link or button. We already have a strongly worded link which tells people to visit update.php unconditionally, so it looks to me like a case of making that link more prominent and/or changing it to a 'button'.

Even if we were to redirect people to update.php automatically, notwithstanding the difficulties dww outlines, nothing stops them backing out of the process and not running updates when they get there either.

Bojhan’s picture

@catch Common in complete honesty, you don't see the obvious usability problem? This is a workflow issue, not to be solved by better wording or a button. Instead it should be solved where it is occurring, sure when they get too the page they can back out - but that's no argument for denying the usability problem.

Even though @dww argues its very hard, why should that stop us? I would say even "new" behind updates sencetence would already trigger people to run updates more than whatever we got now.

tstoeckler’s picture

Since update.php is a standalone script independent from Drupal, just as authorize.php would it be a problem to call update_batch() from within authorize.php? That way we wouldn't have to tell people to go to update.php we would just do the update for them.

catch’s picture

@Bojhan, no I don't really. If you update a module via ftp, you have to manually run update.php afterwards. Providing a link is already more help than any other mechanism for running updates gives you.

And the reason it being hard should stop us is because:
1. it'd be nice to release Drupal 7 one day.
2. Sometimes the cure is worse than the disease.

Running updates without asking as tsoeckler suggests is worse than just providing a link like we have now - if you get to this point, and you haven't taken a database backup, then you get to update.php and think "oh, I should really take a database backup" - that's a really good reason not to just run it automatically.

sun’s picture

You also need to backup your files/webspace before doing module updates, so as to be able to revert to the previous state on failure. Therefore, backups should be done prior to running authorize.php, not afterwards.

Bojhan’s picture

@catch So I agree, that given the timespan its hard to fix this properly. I just wish some fix to apply here, obviously what tsoeckler is suggesting is not correct. And thats not what I am suggesting either.

@sun That is necessary either way, shouldn't influence what decision we make here.

I will get back to this issue with a proper image explaining what I mean.

dww’s picture

@sun: There's already a landing page in update manager before you even get to authorize.php suggesting you backup everything before you continue.

@Bojhan: This is a Hard Problem(tm), just like #606592: Allow updating core with the update manager. In the abstract, It'd Be Nice(tm) to fix this Properly(tm), but we'd need a lot more people really working on this to make that possible, or this would have to be the only thing I'm worrying about in Drupal (yeah, right). Believe me, I'm as much of a perfectionist as anyone, but simply asserting that something is critical doesn't make it easy to solve and doesn't mean resources magically fall from the sky to make it happen.

@catch: Exactly. ;)

Thanks,
-Derek

EvanDonovan’s picture

As an end-user of Drupal for 2 years now, I believe that having an automated system to install/update modules is already a great improvement, even if it doesn't automagically run update.php.

The key is to have wording that conveys to users "You should run update.php now." From #27 it looks like we have that.

So can this be counted "fixed"?

Bojhan’s picture

FileSize
13.76 KB

new-database-updates.png

So something like this is what I propose, there has to be some identifier that there are database updates. We simply can't just show them a link and have them wonder when to click or not click it.

dww’s picture

Re: "there has to be some identifier that there are database updates"

I don't know how to say this any other way: We. Can't. Know. This.

It's possible (sometimes even easy) to draw pictures for how we want the world to look. Yes, we all agree the best workflow would be for this link to conditionally appear if needed. However, there are deep, far-reaching technical limitations (which I've explained multiple times) that make this vision impossible without Very Big Changes(tm) which I suspect Drieschick aren't going to want to see happen this late in the D7 development cycle.

Bojhan, I understand there are UI/workflow bugs here. It's not perfect. But, we can't make this perfect without a lot more sustained effort on Update manager from a wider pool of people. For whatever reasons, other D7UX improvements like overlay got the vast bulk of the resources and attention, while the update manager was basically left as something a tiny group of us did in our spare time...

Bojhan’s picture

Priority: Critical » Normal

:'(

dww’s picture

Keep in mind, it doesn't *hurt* to always suggest the user visit update.php, even if there aren't updates that need to be run. So, one solution here is to remove the other distracting links like "Administration pages", "Front page", etc.

If it's an update, we have one link to "Run database updates".

If it's a new install, we have one link to "Enable newly added modules".

This is still very do-able in D7, and would encourage people to always take the right next step in the workflow they're in the middle of.

Bojhan’s picture

I would definitely favour that suggestion to happen.

EvanDonovan’s picture

I think dww's suggestion in #44 sounds like the best way forward. AFAIK, the standard instructions for Drupal were always to run update.php after you upgrade a module. I have had lots of no-op update.php runs, but it was good just to be sure. Plus, update.php has the nice side effect of flushing all caches.

rschwab’s picture

+1 for the idea in #44.

I think the best solution given the resources at hand is to turn the link into a button that says something along the lines of "Next: Run update script".

Then as instructions beneath the button include all the warnings and other options the user may want to take, such as backing up their database, and links to the admin or front page.

EvanDonovan’s picture

Priority: Normal » Major
Issue tags: +String freeze

#44 needs to happen, in my opinion. No button necessary. "Enable newly added modules" would also be better than "Enable modules in PackageName" as it currently says, so this would kill two birds with one stone.

I'll hopefully get around to coding this string change in the next few days.

rschwab’s picture

FileSize
791 bytes
452 bytes

Patch to remove the extra links printed in authorize.php and to slightly alter the wording of the module and theme post-install messages.

rschwab’s picture

Status: Active » Needs review
dww’s picture

Status: Needs review » Needs work

@rschwab: Thanks for getting this going!

However, the patches at #50 need work for the following reasons:

A) In general, please include all changes in a single patch instead of separate patches for each file you touch.

B) These patches don't actually implement the proposal in #44. ;) Some distraction is removed, but we still need to add the main content we care about which is the correct next step in the workflow based on the current operation.

C) The change about "Enable newly added modules" belongs over at #937698: "Enable newly added modules in [Module Group]" is awkward, should be "Enable newly added modules" not here.

EvanDonovan’s picture

@rschwab: The system.updater.patch looks good, but, now that I look at it, dww is right - it should be at #937698: "Enable newly added modules in [Module Group]" is awkward, should be "Enable newly added modules". You could probably just attach the same patch over there, where webchick and I are following the issue.

In regard to dww's comment B, it looks like the direction forward would be to add a conditional checking whether the module already exists in the database, or whether you have just done a fresh install. I think you could probably do this by querying the {system} table.

I would personally be fine with also removing the Administration and Front Page links, as you have done, but the conditional has to be in there, or the workflow is not fixed as per #44.

rschwab’s picture

Oops! I thought #25 was already in and addressing #52-B. I'll post system.updater.patch to #937698: "Enable newly added modules in [Module Group]" is awkward, should be "Enable newly added modules".

dww’s picture

Yes, removing the extra links is part of my proposal in #44. Also, it's been so long that I don't remember and I don't have time to look at the code, but I'm pretty sure authorize.php remembers what operation you tried to do when you land on the final landing page. You shouldn't need to query the {system} table to figure out if you did a new install or an update.

rschwab’s picture

I just updated some modules with the current version, and the next step was "Run database updates".
I also installed a new module and the link was to "Enable new modules in modulename"

So it looks like #52-B is already in.

My only concern in committing #50 is that those may be the only links on some pages and removing them would leave a dead end. Anyone know for sure?

rschwab’s picture

Status: Needs work » Needs review
FileSize
819 bytes

Here is a patch that makes the links to "Administration pages" and "Front page" the default links authorize.php spits out. They can be overridden by anything that calls authorize.php. The three ways update manager arrives at this script each supply a link to override these defaults already:
- For theme installs its currently "Set the !theme theme as default" (see #975134: Improve links for steps after installing new theme)
- For module installs its currently "Enable newly added modules in !module" (see #937698: "Enable newly added modules in [Module Group]" is awkward, should be "Enable newly added modules")
- For updates, per #25/27, it is "Run database updates"

Bojhan’s picture

I think this is close to RTBC, I wouldn't remove the Administrative link from the list though - Frontpage definitly has low value, but administrative in many cases is still a good step.

dww’s picture

Status: Needs review » Needs work

@Bojhan: except when you're updating. Then "Administration pages" is just a distraction that's likely to get people to forget to visit update.php, which is the whole point of this issue. But, I can see how "Enable new stuff" isn't the only thing you'd want to do after installing something. And in that case, there's little harm in having the user do something we're not expecting. So, for install, maybe we want "Enable newly installed modules", "Install another module", and "View administration pages"?

Bojhan’s picture

@dww I can understand for updating, yes - we only want to display one link (lets make a mental note this is a UX shortcut, ideally we want them to continue to the update page automatically, and all DB updates shown).

For modules, I think saying "Administration pages" should be fine. Install another module is already assuming to much about what the user is trying to do.

dww’s picture

I asked Bojhan about consistently using verbs and he said:

[12:17pm] Bojhan: dww: Yhea, we don't say View administration pages
[12:17pm] dww: okay.
[12:17pm] Bojhan: view adds nothing :)

*shrug*

So, we can still use "Administration pages" even though the other links will have verbs in the install case.

Anyway, I think #57 is good, we just need to re-add a next step link for "Administration pages" to the install case to address Bojhan's concerns.

Bojhan’s picture

I think its oke, it diffrentiates between "a page where you go to do an action" like the module list. To a generic navigation place like /admin for Administrative pages. When we do a test on this, we can actually have a better guess what people will want to do - so far we are only making guesses.

rschwab’s picture

The patch at #57 accomplishes what it does by placing the admin/front links in if no links are provided by the task calling authorize.php.

Given that it seems like we want the admin link on the page in every case except update, should I re-work the logic on this to always print the admin link except if the task is update? Or is it ok to simply add the admin link to the list of links the install task gives to authorize.php?

rschwab’s picture

Status: Needs work » Needs review
FileSize
1.77 KB

After looking over the code it looks as if authorize.php doesn't distinguish between update and install tasks it gets from the update.module. Therefore the attached patch implements #57 and also addresses #58 by adding a link to "Administration pages" to the postInstallTasks methods in system.updater.inc.

The links to "Administration pages" and "Front page" are still the default if a contrib module doesn't include its own links when it calls authorize.php.

dww’s picture

Status: Needs review » Reviewed & tested by the community

Addresses Bojhan's concerns while fixing the major UI bug here in the update case. RTBC. Thanks, rschwab!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Fixed minor indentation bug in the authorize.php hunk and committed #64 to HEAD.

Thanks, folks!

Status: Fixed » Closed (fixed)

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

dww’s picture

FYI: I just opened #1478288: D8: Fix handling of database schema updates in update manager workflow to see if we can do any better in D8. I don't have high hopes, since the problems in here are nasty, but at least there's a place to discuss it and try again...