This issue has novice tasks. If you are an experienced core developer and have multiple commit mentions, please review novices' work on these tasks rather than doing them yourself. Feedback from experienced contributors is valued.

Problem/Motivation

If you have a module that is incompatible with both core and your version of PHP, you get two sentences with no space after the period of the first sentence:

This version is not compatible with Drupal 8.x and should be replaced.This module requires PHP version 5.6.* and is incompatible with PHP version 5.4.26.

Proposed resolution

Be smarter about building this message. Build an array of reasons why the module is incompatible and then implode() them together with a space separator.

Remaining tasks

User interface changes

n/a

API changes

n/a

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

star-szr’s picture

Title: Ugly error message if a module is incompatible with the version of core and the PHP version » Slightly ugly error message if a module is incompatible with the version of core and the PHP version
Issue summary: View changes

Tweaks to the issue summary and issue title.

cs_shadow’s picture

Instead of directly printing the reasons onto the screen, this patch puts each reason as an element of the 'reasons' array. If a module is found to be incompatible, then the reasons array is imploded into a string to print out each reason separated by a space.

Attaching screenshot of error messages after applying this patch as evidence.

Rolf van de Krol’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed the patch. Follows coding standards and solves the issue.

Found however that when a module for some reason incompatible, the description of the module is also hidden (this was already the behavior before the patch and still is). Is this by design?

cs_shadow’s picture

While working on this patch, the same doubt came to my mind as mentioned in #3. IMO the description should still be shown to to the user, even when the module is not compatible.
Need to check if this behavior is by design.

Status: Reviewed & tested by the community » Needs work
star-szr’s picture

This looks good and I think #3 and #4 are a separate matter, please feel free to open another issue (after searching) to address that. The same thought crossed my mind :)

This needs some minor documentation cleanup then I think it's good to go.

+++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
@@ -262,12 +262,14 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
+    //Initialize an empty array of reasons why the module is incompatible. Add each reason as a seaprate element of the array.
+    $reasons = array();

This comment doesn't meet coding and documentation standards. See https://drupal.org/node/1354#drupal.

1) Missing a space after the "//".
2) Comment is over 80 characters, so please wrap.
3) "separate" is misspelled.

cs_shadow’s picture

Status: Needs work » Needs review
FileSize
2.08 KB

Fixed the documentation. Will open another issue regarding #4.

cs_shadow’s picture

star-szr’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
35.7 KB
31.03 KB

Thanks @cs_shadow! Attaching before and after screenshots to clearly show the difference.

Before:

After:

star-szr’s picture

And please post back here when you create the other issue, I'd love to help with that.

cs_shadow’s picture

@Cottser, happy to help. This is the link to the issue I opened reg #4: https://drupal.org/node/2230865. Seems we already have a patch for the same.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Lovely. Yay for spaces. :)

Committed and pushed to 8.x. Thanks!

Does this affect 7.x as well?

  • Commit 9442bea on 8.x by webchick:
    Issue #2227687 by cs_shadow, Cottser: Slightly ugly error message if a...
star-szr’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Patch (to be ported)
FileSize
37.47 KB

Indeed it does affect 7.x:

diff --git a/modules/forum/forum.info b/modules/forum/forum.info
index b18a0e5..26dcbe4 100644
--- a/modules/forum/forum.info
+++ b/modules/forum/forum.info
@@ -4,7 +4,8 @@ dependencies[] = taxonomy
 dependencies[] = comment
 package = Core
 version = VERSION
-core = 7.x
+core = 8.x
+php = 5.6
 files[] = forum.test
 configure = admin/structure/forum
 stylesheets[all][] = forum.css
cs_shadow’s picture

Status: Patch (to be ported) » Needs review
FileSize
2.32 KB

Attaching the patch for 7.x

star-szr’s picture

Status: Needs review » Needs work

Nice, thanks @cs_shadow!

+++ b/modules/system/system.admin.inc
@@ -995,22 +995,27 @@ function _system_modules_build_row($info, $extra) {
+  // Initialize an empty array of reasons why the module is incompatible. Add
+  // each reason as a separate element of the array.
+  $reasons_short = array();
+  $reasons_long = array();

The only thing is there are now two arrays so "an empty array" makes less sense. "two empty arrays" might work, or something that explains that there are short and long descriptions. Just mind the 80 character wrap :)

cs_shadow’s picture

Status: Needs work » Needs review
FileSize
2.36 KB

Fixed the documentation in this patch.

star-szr’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, those docs look better! The early break is a bit unusual I think but can be fixed on commit IMO if someone objects :)

star-szr’s picture

FileSize
29.35 KB

And here's the missing "after" screenshot:

Status: Reviewed & tested by the community » Needs work
star-szr’s picture

star-szr’s picture

Status: Needs work » Reviewed & tested by the community
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

  • Commit b852638 on 7.x by David_Rothstein:
    Issue #2227687 by cs_shadow | Cottser: Slightly ugly error message if a...
star-szr’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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