Steps/Process:
I downloaded/installed beta1 and enabled the update module.
Manually checked for updates.
Was correctly informed that beta2 was out there and I should update.
Copied the URL for the .tar.gz of beta2 and inserted it into the input for the "automatic module installer".
The upload went fine and I was told the install was successful.
Next page reload shows:
---Notice: Use of undefined constant STREAM_WRAPPERS_LOCAL_NORMAL - assumed 'STREAM_WRAPPERS_LOCAL_NORMAL' in system_stream_wrappers() (line 1548 of /home/xxx/drupal7/sites/all/modules/drupal-7.0-beta2/modules/system/system.module).---
I ran the database update script which went off without a hitch.
Same problem though.
I deleted the beta2 "module" and the entire site crashed.
Summary: Basically, I deviously tried to upload drupal-7.0-beta2 as if it were a module to see what drupal would do.
Praise: I'm 30min in to test-driving the system after 14months hiatus from Drupal6 and this system definitely has me excited!
Note: maybe this is an update.module bug?
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 958046-update-manager-download-core-13.patch | 1.03 KB | tstoeckler |
| #10 | 958046-update-manager-download-core-10.patch | 1.11 KB | tstoeckler |
| #7 | 958046-update-manager-download-core-7.patch | 968 bytes | tstoeckler |
| #5 | 958046-update-manager-download-core-5.patch | 1.16 KB | tstoeckler |
| #4 | update-manager-core.png | 43.88 KB | tstoeckler |
Comments
Comment #1
int commentedWe should not update the drupal-code with the automatic module installer.
We should detected if what we are download if in fact one Drupal Module. (e.g. find and read the info file)
Comment #2
EvanDonovan commentedRetitling issue to better describe required fix.
Comment #3
tstoecklerThis implements a check for bootstrap.inc in a new update_verify_update_archive() (similar to #936490: Update module should verify downloaded tarballs and propagate errors correctly).
Screenshot coming up.
Comment #4
tstoecklerAnd the screenshot.
Comment #5
tstoecklerThe @see's where leftovers from #936490: Update module should verify downloaded tarballs and propagate errors correctly.
Comment #7
tstoecklerWow, the test bot is picky these days :)
Now with a properly initialized variable.
Comment #8
EvanDonovan commentedJust tested this, and it stopped me from installing Drupal 7 beta 3 from tarball, as expected. Here is a screenshot of the error it throws when you try it: https://skitch.com/evandonovan/rbwni/updating-drupal-core.
The only possible improvement would be if the error it throws would like to the upgrade guide. Something like, "Updating of Drupal core is not supported. To learn how to update Drupal core, please read the upgrade guide."
Comment #9
EvanDonovan commentedJust as an FYI to other testers: this patch and the one in #936490: Update module should verify downloaded tarballs and propagate errors correctly implement the same hook, so you can't have them applied at the same time, and one will need to get re-rolled after the other is committed.
Comment #10
tstoeckler#8 sounds like a pretty awesome idea.
New string:
Comment #11
EvanDonovan commentedJust a simple string change. Patch should still be good.
Thanks! I would mark RTBC but not sure if there are other technical implications.
Comment #12
Stevel commentedThis implementation is just plain weird.
If the function returns (i.e. the return statement is executed), it will return an empty array. Also, the variable is set as $failure[...] instead of $failures[...] (extra s), but that doesn't really matter...
Just the if-construct and the exception should be enough. Also, document why we throw an exception instead of following the API docs for hook_verify_update_archive().
Comment #13
tstoecklerWell, the thing is that (at least that's what I thought) we want a dedicated error message for this to guide user's what the exact problem is. The API doc for hook_verify_update_archive mentions putting something in $failures, but then doesn't use it, it just uses the exception. Since there is a
empty($failures)check, I had thought we need to place something in $failures, but as you correctly point out, my code doesn't actually do that, but still seems to work. I will investigate, whether we have to return anything at all or not.Comment #14
tstoecklerWell, it seems this actually works, so why not?
Comment #15
Stevel commentedJust to make it clear:
update_manager_archive_verify()(which callshook_verify_update_archive()) doesn't use the exception you throw. It just throws an exception when$failuresis populated. However, when the exception inupdate_verify_update_archive()is thrown, the rest of the code inupdate_manager_archive_verify()is skipped (and so is other code until the exception is catched, which is where code execution is resumed).Thinking about this some more, I'm not happy with throwing an exception in
update_verify_update_archive(), as it violates the Liskov principle (which is really an OO concept, but the idea remains the same) here. Thehook_verify_update_archive()API does not mention any exceptions thrown. This means code executing this hook shouldn't need to bother about exceptions, but if they don't: BANG!The only solution which does not require an API change (or violation) is returning
$somethingfor which!empty($something), but then we have no way of setting an error message. I would suggest (for D8 if it's too late for now) changinghook_verify_update_archive()to return an error message to be set, instead of just anything not-empty, and using this error message inupdate_manager_archive_verify(). In that case there should be a TODO about it, either atupdate_verify_update_archive()or atupdate_manager_archive_verify().Oh, and also needs work because the comment following the function declaration should be on a separate line.
Comment #16
EvanDonovan commentedNot entirely sure what all that means, but are you saying that there's no way to properly set an error message in this function? I think that we have to be able to set an error message, even if it's technically the incorrect way to do it, since the UX will be terrible if not.
Comment #17
tstoecklerWe could also use drupal_set_message(), I suppose. Maybe we can get another review on the patch. I don't really care for the implementation. Except that, as you portray, using the hook in the documented way doesn't make much sense, as you don't get a custom error message.
Comment #18
EvanDonovan commented@tstoeckler: Why don't we just use drupal_set_message() and call it a day then? :)
Sounds like there are issues with the hook that can't be fixed at this juncture, whereas this issue needs to be fixed.
Comment #19
dwwAs with many parts of the update manager, we put in some hooks in the hopes that they'd be helpful, but no one ever tried using them until now. So, it's entirely possible that the existing hook API is broken and needs to be fixed. I'd be in favor of that, instead of hacking around it and trying to propagate errors solely through drupal_set_message(). Error propagation already sucks a lot in the update manager. We shouldn't add to that suckage here if we can help it.
Comment #20
dwwp.s. Is this really the best we can come up with to finger-print a tarball includes core?
That seems awfully fragile. I might have an includes/bootstrap.inc in a contrib module. If we added another 4 or 5 tests (e.g. for index.php, update.php, modules/system/system.module, and modules/node/node.module) all of which had to be TRUE before we triggered the error, I'd be a lot happier.
Comment #21
yoroy commentedFWIW, the wording of the message is perfectly fine.
Comment #22
dwwIn the interest of getting this done in time for rc1, I'm merging this issue into #936490: Update module should verify downloaded tarballs and propagate errors correctly. Let's continue over there. Thanks.
Comment #23
wdkish81 commented#3: 958046-update-manager-download-core-3.patch queued for re-testing.
Comment #24
Tor Arne Thune commented