Problem/Motivation
The Simpletest module requires a PHP Curl library to be installed, as does Aggregator. This requirement only comes up in the error message when a user tries to install the module, and it consequently fails.
The error message itself only links to a page on php.net that gives the Drupal user who followed the link no information that is relevant for a Drupal installation.
Proposed resolution
Preferred solution: Disable the ability to enable Simpletest if Curl is not available, and put this message on the Extend page... could look something like this:
However, this is probably not feasible, given that this requirement is only tested in hook_requirements(), so it isn't accessible to the Extend page (at least at the moment).
So... at least provide a useful error message that gives you some installation information.
Remaining tasks
Get the patch committed.
User interface changes
Message when cURL is missing is more helpful. UI text changes.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#85 | improve_module_description_curl-2474017-85.patch | 1.83 KB | casivaagustin |
#83 | screenshot-79-8.3.x.jpg | 282.81 KB | casivaagustin |
#79 | improve_module_description_curl-2474017-79.patch | 1.94 KB | wingmanjd |
#78 | interdiff-2474017-75-78.txt | 2.25 KB | pguillard |
#78 | improve_module_description_curl-2474017-78.patch | 1.92 KB | pguillard |
Comments
Comment #1
ifrikUpdated the issue summary, because this is not an issue of Drupal but of the server setup.
Comment #2
ifrikComment #3
colorfieldComment #4
colorfieldComment #5
ifrikThanks colorfield,
that looks all good.
Comment #6
ifrikComment #10
joshi.rohit100I think no need to change the hook_help part as if curl is not available then module will not install and so there will be no help page. Help page only exists if module is enabled and if module is enabled, means curl is there.
Comment #11
colorfieldWas also my first opinion about hook_help. In a site builder point of view, in D7, the right place was README.txt, but does not seem to be popular in D8, that's why I reconsidered hook_help. That's my first patch, any idea why the test does not pass? The text format seems to be OK. Thanks.
Comment #12
ifrikI would very much like to have a section about the requirement in the help text, even if it's not accessible when the module is not turned on.
For anybody running sites in different environments, it would explain them why the module can be installed on one and not the other.
And since the help isn't long it's not getting into the way of anything.
Adding an explanation to the README file, is a good additional idea.
Comment #13
colorfieldcURL is a requirement for other modules (e.g. aggregator). The description of this requirement is duplicated on the hook_requirements of each module, e.g.
The cURL status is also available on admin/reports/status.
Shouldn't we create + include the URL of a centralized community documentation page about that?
This page could be easily improved over time (when os changes, ...).
Comment #14
darol100 CreditAttribution: darol100 as a volunteer and commented@colorfield, I do not know why the automatic test fail but I took your changes and re-roll this patch.
Comment #16
evgeny.chernyavskiy CreditAttribution: evgeny.chernyavskiy as a volunteer commentedComment #17
evgeny.chernyavskiy CreditAttribution: evgeny.chernyavskiy as a volunteer commentedRebased https://www.drupal.org/node/2474017#comment-9988811 without conflicts. Amended the message a bit to include command line instructions.
Comment #18
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedUpdated issue summary.
Comment #19
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedComment #20
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedThis help will not be visible unless the module is enabled, and the module can't be enabled without cURL. Can we move this to a drupal.org page and link it from the module description?
Comment #21
subhojit777Agree with #20. Also I'm not sure about whether we should include this in core. If this is going to be part of core then we have to find some way to invoke hook_requirements() while generating the module list page. Currently it only invokes while a module is installed. I pinged my concerns in IRC but nobody replied. I will raise my concerns again. And definitely this is not a novice issue. Also the issue summary seems misleading if we are not going to insert the requirements in hook_help() (we need to correct the screenshots).
Comment #22
jhodgdonApparently this needs to be "rc deadline" because it changes translatable UI text strings. See https://groups.drupal.org/node/484788
Comment #23
subhojit777Comment #24
subhojit777I believe testbot has curl extension enabled by default, therefore marking this as "Needs manual testing" because someone has to test whether this "actually" works. I don't have a clue how to disable curl extension in MAMP. Will try to test this in my Ubuntu machine later.
Comment #25
subhojit777oops..
Comment #26
subhojit777Comment #27
subhojit777Comment #28
joshi.rohit100can we use extension_loaded() instead of function_exist() ?
$this->t()
Comment #29
subhojit777@joshi.rohit100 Thanks for the review. I am not sure about your first suggestion. There's an issue for this #1942432: Use extension_loaded instead of function_exists to detect PHP extensions, the comment [#1942432.4] is quite interesting and is the reason why I don't want to use
extension_loaded()
. Also I took the code fromsimpletest_requirements()
, I am inclined towardsfunction_exists()
. Can you please test this patch.Comment #30
jhodgdonThanks!
So... At this point, except for dire emergencies, we cannot change translated strings. So we don't want to change the module description as is done in the patch (the part in the .info.yml file). Besides which, there are zero other module descriptions in Drupal Core that say what the requirements are for installing the modules -- that is not how we indicate that -- we use hook_requirements().
The other part of the patch looks wrong to me too. It seems to be requiring that the curl library be installed for ***any*** module installation. Uh???? That cannot be right. We only want to improve the feedback for the simpletest module.
So this patch is not OK.
What we would *actually* want to do is modify simpletest_requirements(), which is the hook_requirements() implementation in core/modules/simpletest/simpletest.install. That is already testing whether curl is installed. This issue, at least according to the title, is about improving the message that you get if the curl library is not installed, which is generated inside that function.
And... at this point, we are past Release Candidate, so fixing that message would probably require a translated string change. I do not think that a "normal" bug is enough to justify that. So moving this issue to 8.1 at this point.
Comment #32
BQari CreditAttribution: BQari commentedComment #34
BQari CreditAttribution: BQari commentedComment #35
jhodgdonThese supposed patch files have all kinds of weird characters in them. I'm inclined to think they are spam and am reporting them as such.
Comment #36
BQari CreditAttribution: BQari commentedComment #37
BQari CreditAttribution: BQari commented@jhodgdon I have deleted the Patch,Thanks for letting me know
Comment #38
jhodgdonWhat were those files???
Comment #39
pguillard CreditAttribution: pguillard commentedComment #40
pguillard CreditAttribution: pguillard commentedIn conclusion, I guess :
- As we should not say what the requirements are for installing the module in the module description.
- As the help text will not be visible unless the module is enabled.
- As we can't disable the ability to enable a module in module list if a requirement (other than the presence of a module) is not met.
=> I just applied the new error message in hook_requirements, until we have a documentation page on Drupal.org.
Comment #41
pguillard CreditAttribution: pguillard commentedComment #42
jhodgdonA few suggestions on this text:
a) See #2571845: Links to wikipedia/php.net should be part of the actual t() string so they can be localized -- we actually want php.net and wikipedia links to be part of the t() string, not separated in options, in translation strings.
b) Can we make the link text for the php.net link "PHP cURL library" for better accessibility?
c) "You should check the cURL status in PHP via phpinfo() or in the command line via `php -m | grep curl`. "
We don't normally want to say "should", maybe "can". But... if this text is being shown, doesn't that mean cURL is not enabled? In which case, why would they even need to check the status of cURL?
Anyway, if for some reason you do think we need this sentence, let's link them to the phpinfo() report within Drupal, the one that the route "system.php", rather than suggesting running commands at the command line or within PHP, which the average site builder would not know how to run.
d) Maybe prefix the installation instructions with something like "To install the cURL library..."?
Comment #43
pguillard CreditAttribution: pguillard commentedThis patch is applying #42 suggestions.
c) I do not know if we need the sentence, anyway I made the link to the phpinfo() report page, I choosed "phpinfo() page" for the link name.
Comment #44
jhodgdonMuch better, thanks! Removing some extraneous tags...
So... I have a few questions that I don't know the answer to:
a) I am not sure we should say "Unix". Most people do not run Unix per se, and it is a trademark. We should see what we do in other readme files and documentation to indicate "something like Unix or Linux or whatever" and do the same as we've done there.
b) Do you think people would know how to install PHP extensions on Linux/Unix?
c) Do the Unix/Linux instructions also apply to Mac?
d) The Windows instructions say you need to remove a ; somewhere but don't say what file that is.
e) In general... I am not sure we should be putting all of this information into a hook_requirements(). I think normally what we do is put a short message and link to a drupal.org page that gives more information, don't we?
Comment #45
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedI think we only need to say "you need the curl extension". That is done in a myriad of different ways on different operating systems and development stacks, so I think trying to cover common use cases in help text is going to be difficult, and potentially confuse people when, for example, they are on Windows and don't use XAMPP.
Comment #46
jhodgdonWell... The main point of this issue is that in simpletest.module (as well as aggregator.module and maybe elsewhere?), we are currently just linking people to http://php.net/manual/en/curl.setup.php . This page has zero information on it. If you click through to the Installation page you get to http://php.net/manual/en/curl.installation.php -- and that page tells you to recompile PHP (which I think nearly no one will be doing).
But I don't think we can just say "you need cURL" without some link to how to install it. That wouldn't be very illuminating either, though probably slightly better than linking them to a page that says they need to recompile PHP.
Comment #47
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedSo - can we start a docs page with a nice URL on d.o? I can begin writing up installation procedures for common platforms and dev packages.
Comment #48
jhodgdonProbably there should be a brief mention in this section along with the other extensions:
https://www.drupal.org/requirements/php#extensions
Then you can make a child page for the details, and if you start one I can add a nice URL to it. Thanks!
Comment #49
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedOk, mentioned here: https://www.drupal.org/requirements/php#curl
Child page: https://www.drupal.org/node/2697465
Comment #50
jhodgdonLooks good. I've added an alias for the page, so you can now see it at
https://www.drupal.org/requirements/php/curl
Question about the page: it seems like it is saying at the top that cURL is required for Drupal 8 in general... that isn't right, is it? Must be the wording. Also, another note: the aggregator module also requires cURL at least in 8, possibly also in 7.
And... THANKS!
Comment #51
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedAh yes, you're right, I misinterpreted the Guzzle requirements as needing cURL when that's not a hard requirement per: http://guzzle.readthedocs.org/en/latest/overview.html#requirements
Core seems to be using Guzzle 6.1.0 so PHP stream wrappers are an option. Let me update the docs and roll a new patch pointing at them.
Comment #52
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedComment #53
jhodgdonThanks! I did a minor edit at the top of the docs page (the simpletest module is actually called Testing in the UI, and also I mentioned Aggregator).
Regarding the patch:
a) Don't say "please". See
https://www.drupal.org/node/604342
(Style section at the top).
b) We need this in aggregator module as well as simpletest.
Other than that, looks good!
Comment #54
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedThanks!
Updated:
Comment #55
jhodgdonLooks great to me! One small thing:
This "use" line is missing from aggregator.install
Comment #56
pguillard CreditAttribution: pguillard commentedI have not pursued cause I was sailing !
I added the "use" instruction, and I guess the link to "Install the PHP cURL extension" page needed a name.
Comment #57
jhodgdonAlmost!
Can we change the wording of the first sentence here to be more similar to the other one? Something like:
The Aggregator module requres the (link)PHP cURL library(end of link).
The last "For instructions on how to install..." sentence here didn't get the updates you made to the Aggregator sentence (that one seems better to me).
Comment #58
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedBoth messages should be consistent now, with the only differences the name of the module being enabled (or not, in this case).
Comment #59
jhodgdonLooks good now, thanks!
Updated issue summary.
Comment #60
Cameron Tod CreditAttribution: Cameron Tod at Acquia commentedIf you're following this issue and have instructions for another platform, please add them to https://www.drupal.org/requirements/php/curl :)
Comment #61
catchThis makes the message very long, and it's possible that people won't be able to install curl themselves. What about linking to https://www.drupal.org/requirements/php/curl and putting all the relevant information there?
Comment #62
jhodgdonThe main problem I see with the suggestion in #61 is that the drupal.org page will not be translated, and a secondary problem is that it is not included with the Drupal.org download.
So I think we need to provide at least the basics in the message rather than assuming that (a) the drupal.org page is reachable and (b) it is readable by everyone who needs the information (such as Chinese readers). I think we have taken that stance before in UI text and help: provide the bare minimum in the UI text, and provide a link to drupal.org or php.net or Wikipedia or whatever for more information. The question is what "bare minimum" is... we want to make sure that whatever we provide is clear and understandable even if drupal.org is not readable for the user.
Comment #63
yoroy CreditAttribution: yoroy at Roy Scholten commentedI expected to find this on the Extend page but don't see anything changed there using simplytest. Should I be looking elsewhere?
Comment #64
jhodgdonAs noted in the issue summary, you only get the message when you actually go to try to install either Aggregator or Testing module, and then only if your server is missing the cURL library.
Comment #65
yoroy CreditAttribution: yoroy at Roy Scholten commentedAh right, my apologies. But, that makes the UI hard to review indeed. Hope somebody can add some screenshots.
Comment #66
jhodgdonIndeed. I think you can temporarily disable the cURL extension from PHP on a local server in order to see it... but not sure. Also the original issue asked that this be improved by adding it to the Extend page, but the problem is that it's hook_requirements() not a module depending on another module, and we have no easy way to do that on the Extend page at this time. Perhaps we should rethink that.
Comment #67
Bojhan CreditAttribution: Bojhan as a volunteer commentedCan we get screenshots, this is not reviewable :(
Comment #68
pguillard CreditAttribution: pguillard commentedI guess I'm too brutal ? This is what I do to test it :
And here is a screenshot :
try-install-after-patch
Links check :
Comment #69
waltria CreditAttribution: waltria commentedI'm at DrupalCon and am about to try and test this fix...
Comment #70
jhodgdonThanks for the screenshots in #68 -- that does seem like an excellent way to test the UI. Any usability comments?
Comment #71
pguillard CreditAttribution: pguillard commentedComment #72
ifrikComment #73
ifrikThanks for the patch and the screenshot.
The error message now provides relevant information that will help users further.
Comment #74
xjmThanks for the ongoing work to refine this text. I agree that a
hook_requirements()
message is more appropriate than the module description.These strings should use the URL placeholders (
:phpinfo_url
rather than@phpinfo_url
).Also, I think it would probably be better and less verbose to use
\Drupal::url()
. (I realize HEAD already has both patterns forsystem.php
.) That would also mean removing theuse
statements. :)Finally, I'm wondering if this text is actually too much information. I see that @catch and others have given the same feedback. We are providing three different actions for the user to follow. Do we need all three of them? Would simply the second two (the PHP info page and the comprehensive d.o docs) be sufficient, now that we have that handbook page? Or something more concise like:
Because the first two times I read it, I thought that "Install the PHP cURL extension" was somehow a link to do that, rather than a d.o handbook page about it.
Comment #75
pguillard CreditAttribution: pguillard commentedApplied the 2 first points of #74 at the moment.
So missing the text simplification part, cause I don't know.
Comment #76
pguillard CreditAttribution: pguillard commentedJust changed a typo in the title
Comment #77
ifrikI agree that we can shorten that message, and only provide one or two links. The link on how to check PHP settings is a step in installing the extension and should be on documentation page.
We can also use the suggested wording for the help pages.
The testing framework requires the <a href="http://php.net/manual/curl.setup.php">PHP cURL library</a>. For more information, see the <a href="https://www.drupal.org/requirements/php/curl">online information on installing the PHP cURL extension</a>.
Comment #78
pguillard CreditAttribution: pguillard commentedThanks @ifrik for the clarification, as I was not sure to make it right.
Applied #77 suggestion.
Comment #79
wingmanjd CreditAttribution: wingmanjd as a volunteer commentedRe-rolled patch from #78 so php.net urls use https.
Comment #81
ifrikComment #82
casivaagustin CreditAttribution: casivaagustin as a volunteer and at 42mate commented...
Comment #83
casivaagustin CreditAttribution: casivaagustin as a volunteer and at 42mate commentedFor what is worth, this is how it looks #79 patch in 8.3.x branch (also looks good in 8.2.x)
Comment #84
Gábor HojtsyThe phpinfo URL is not used in either text.
Comment #85
casivaagustin CreditAttribution: casivaagustin as a volunteer and at 42mate commentedI have removed the phpinfo URL from the patch #79
Comment #86
casivaagustin CreditAttribution: casivaagustin as a volunteer and at 42mate commentedComment #87
Gábor HojtsyLooks good now and the direction is in line with the discussion above.
Comment #88
alexpottCommitted 102175d and pushed to 8.3.x. Thanks!
Comment #90
Gábor HojtsyYay. thanks all!