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.
Problem/Motivation
Sub-task of #1862398: [meta] Replace drupal_http_request() with Guzzle.
To test the patch
- Checkout latest 8.x and apply the latest patch
- Drop database
- Remove sites/default/settings.php
- Remove directory sites/default/files
- Install Drupal via the browser
- In the first installation step select a non-English language.
- The installation should be completed without errors.
Comment | File | Size | Author |
---|---|---|---|
#33 | step-1.png | 23.86 KB | vijaycs85 |
#33 | step-2-new.png | 26.59 KB | vijaycs85 |
#33 | step-3.png | 32.36 KB | vijaycs85 |
#33 | step-4.png | 22.68 KB | vijaycs85 |
#33 | step-5.png | 45.13 KB | vijaycs85 |
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedConverting the drupal_http_request to Guzzle. No specific feedback on exceptions, as the current code does. This may be improved in a way that
install_check_localization_server()
can be replaced by diagnostic feedback frominstall_retrieve_file()
. But this should be postponed until #1875792: Standardize Guzzle exception handling has come to a solution.Comment #2
tstoecklerThat should be "HTTP" now I guess, instead of "http".
I generally like chaining, but in the former case it feels like a bit much. I guess it's just a matter of taste, but I find the latter example much more readable.
Leaving at needs review, because both issues are very minor.
Comment #3
Sutharsan CreditAttribution: Sutharsan commentedComments processed.
Comment #5
Sutharsan CreditAttribution: Sutharsan commentedComment #6
Sutharsan CreditAttribution: Sutharsan commentedComment #7
BerdirA curl exception is now a BadRequestException (which BadResponseException extends from), so that's what you should catch.
Comment #8
Sutharsan CreditAttribution: Sutharsan commentedBadResponseException changed to RequestException.
Comment #9
BerdirI think this is good to go. This is so early in the installer that we can't do exception handling and we didn't do so before, this just converts the calls.
Comment #10
catchCommitted/pushed to 8.x, thanks!
Comment #11
catchI just tried to re-install with an existing database and got this message instead of the usual "you've already installed don't do it again" message:
That's not as useful..
Reverted for now to avoid inflating the critical bugs list.
Comment #12
Sutharsan CreditAttribution: Sutharsan commented@catch, I can't reproduce this error. This is what I've done:
Using Mysql database:
1. Dropped the database (drush sql-drop)
2. Ran the installer in the browser (/install.php) Language: English, Profile: Standard
3. Completed the installation and visited the new website.
4. Attempt to re-install in the browser (/install.php)
Repeated the above with Dutch as installation language.
Dropped the sites/default/files and sites/default/settings.php and repeated all the above steps using SQLight as database.
In all cases I get the usual "Drupal already installed" page.
Comment #13
Sutharsan CreditAttribution: Sutharsan commentedI also couldn't reproduce it with the patch applied to the last commit before #10 (a62c75ed68f2fd742e3a82bbb932c9bff5a2085f). I've tried English + SQLight and Dutch + Mysql. No errors :(
@catch, can you remember your steps?
Comment #14
tstoecklerI think what is meant in #11 is that @catch did *not* drop the database before hitting install.php. He expected the usual "You've already installed Drupal, what are you doing here?" message, but instead got a fatal.
Comment #15
Sutharsan CreditAttribution: Sutharsan commented@tstoecker, that is what I did in step 4 of my description. Going to /core/install.php while already having an installed site. But now I read it back, that was not very clear.
Comment #16
tstoecklerWell, but If I read that correctly, you re-installed from the start with the patch already applied. That is what seems to be the problem (that's what I assume, at least). Catch hit install.php on an existing site directly after applying the patch.
Edit: Wrote something other than what I meant...
Comment #17
catchHere's the steps (from memory so hopefully I didn't miss anything):
1. Didn't drop database
2. English (British) was autoselected - however note this fails to download with the patch not applied on my localhost.
3. settings.php was filled in etc.
4. Re-install attempted via install.php
Comment #18
Sutharsan CreditAttribution: Sutharsan commentedI think I've tried all variations now, but can't reproduce this:
Let me be bold, I'm putting it back to RTBC.
Comment #19
Sutharsan CreditAttribution: Sutharsan commentedCreated an issue for not being able to install in British English: #1904214: Installer auto-selects languages that don't have a translation, causing a requirements error
Comment #20
catchHmm I can't reproduce it either, followed up on the other issue though.
Committed/pushed this one.
Comment #21
webchickI just tried to install in French and got "The service definition "http_default_client" does not exist." :( It goes away when I roll back this patch.
Comment #22
Sutharsan CreditAttribution: Sutharsan commentedNow I can reproduce too :(
Comment #23
Sutharsan CreditAttribution: Sutharsan commentedThe problem lies in the 'http_default_client' service being registered in CoreBundle::build(). This is only called several steps later in the installation (after the database settings form). And therefore not available this early in the installation. Not use how to fix this, either by registering this Guzzle library early in the installation process or by not using this patch and keeping the drupal_http_request(). I guess the first solution is preferred, but I don't not know how to do this.
And how much I hate to say this, I think the quick fix is to roll back this patch again.
Comment #24
BerdirYou can also set up a Guzzle HTTP Client yourself.
There is also an issue that will change how the whole thing works, but I'm not exactly sure what happens with the CoreBundle.
Comment #25
Sutharsan CreditAttribution: Sutharsan commentedThere was this thing in the back of my head ... of course other services are registered too for installation. Adding the http client service did the trick.
The patch needs some more eyes, I copied the registration code from CoreBundle.php.
Comment #26
catchNot sure why I couldn't reproduce this again. Patch looks good and what I was expecting but yeah thanks for the 'needs manual testing' tag :)
Comment #28
Sutharsan CreditAttribution: Sutharsan commentedThe bare (base) minimal upgrade tests run fine in my sandbox. Lets give the bot another try.
Comment #29
tstoecklerThe $container->register() should be moved up before the call to dupal_container($container), I think. I guess this works because objects are handled as references in PHP, but conceptually this is wrong. Here we're setting the container, and a few lines down down we're fetching it again.
Minor: http -> HTTP, translation file -> translation files,
localization.drupal.org -> localize.drupal.org
Moving to needs work for that, although, since this apparently fixes translation in other languages (I didn't try it out myself) it might (or might not) make sense to commit this as is.
Edit: Missing word.
Comment #30
Sutharsan CreditAttribution: Sutharsan commented@tstoeckler, thanks for the comments. All processed.
Comment #31
vijaycs85I did below on Windows 7/Firefox-18.0.1
Step 1:
Step 2:
Seems I have access to translation server:
Am I missing something here?
Comment #32
Sutharsan CreditAttribution: Sutharsan commented@vijaycs85, the problem you run into is different than the one we are fixing here. But thanks for testing anyway ;) If you have time, contact me in IRC to debug this one together.
Comment #33
vijaycs85Seems that was my network issue. Though, I can see translation site, Drupal somehow can't access. is it worth mentioning port in help text or would it become too technical/confusing?
I manage to test it in other network and except a warning in step-6 (site information page), no error!!!
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Comment #34
Sutharsan CreditAttribution: Sutharsan commented@vijaycs85, the confusion is in the difference between the computer and the server. The computer can access, the server can't. We need to improve this but is a different issue.
Comment #35
thsutton CreditAttribution: thsutton commentedI applied @Sutharsan's patch in #30 to 8.x 2f7db4222b2afc4415b9fad0ad578b142ab8cf3d and found:
PHP Fatal error: Call to a member function get() on a non-object in /Users/thsutton/Sites/drupal8/htdocs/core/includes/bootstrap.inc on line 2481, referer: http://ttt.dev/core/install.php?langcode=fr&profile=minimal
Comment #36
thsutton CreditAttribution: thsutton commentedForgot to change status.
Comment #37
Sutharsan CreditAttribution: Sutharsan commented@thsutton, this error occurs when module_implements() is being called. Can you describe the steps to reproduce this, because I don't see this error. Your description "... later on during the installation ..." makes me think the error is not related to this issue. Can you reproduce the error with the patch reverted (git apply --reverse)?
Comment #38
Sutharsan CreditAttribution: Sutharsan commentedI've created #1912886: Improve installation language requirement descriptions and offline detection to tackle the problem @vijaycs85 had with determining the cause of not being able to download a translation file.
Comment #39
thsutton CreditAttribution: thsutton commented@Sutharsan, the installation with no translation selected completed normally with and without the patch. Steps to reproduce:
Here's the Apache error log from the start of the installation:
I tend to agree that this is unrelated, except for the fact the leaving the language as en (with or without the patch) completes the "installation profile" phase and you can continue with configuring the site and get a working install. :-)
Comment #40
Sutharsan CreditAttribution: Sutharsan commented@thsutton, I still can't reproduce. It may be environment dependent, although I don't think it is likely: php 5.3.15, mysql 5.5.27 I don't get the 'MenuLinkStorageController' error either. This error is weird though, as if the auto loader failed.
Did you clean the sites/default/files directory before re-install
If you revert the #8 patch (git apply -R http://drupal.org/files/install-convert-to-guzzle-8.patch) to D8 HEAD, can you still reproduce the error?
Comment #41
stjin CreditAttribution: stjin commentedI installed the #30 patch as described above (language dutch). It works like a charm! Thanks.
Comment #42
hass CreditAttribution: hass commentedCurrent DEV cannot installed if you select a language other than English. This looks still major to me.
Comment #43
yannickooHad the same problem when trying to install in German language but with patch from #30 it works fine!
Comment #44
tstoecklerI think that is sufficient testing that this actually does fix the problem. Code looks good as well. Let's do this!
Comment #45
stjin CreditAttribution: stjin commentedYes the code does indeed fix the problem. I applied the patch then did a clean install (dutch), and it worked.
Comment #46
catchThanks for all the manual testing.
Committed/pushed to 8.x.
Comment #48
danilocgsilva CreditAttribution: danilocgsilva commentedJust downloaded the 20 April dev version and faced this issue. Patch #30 doesn't worked for me: Hunk #1 FAILED at 356
Comment #49
BerdirOpen a new bug report if you have a problem. This has been committed long ago.
Comment #49.0
BerdirTest instructions added