System module page *seriously* broken

dmitrig01 - March 2, 2008 - 19:09
Project:Drupal
Version:7.x-dev
Component:system.module
Category:bug report
Priority:critical
Assigned:dmitrig01
Status:patch (code needs work)
Description

Here's a little patch...

AttachmentSize
system_modules_cleanup.patch11.12 KB

#1

David_Rothstein - March 7, 2008 - 18:55
Status:active» patch (code needs work)

So the goal here is to clean up the underlying form array structure on that page, right? Sounds nice. I tried it and a couple issues came up:

  • The theming needs to be fixed (see attached screenshot!)
  • What happened to the throttling checkbox -- it looks like that was taken out?
  • The module dependencies are being stored in the $extra array, but that never gets copied into the $form array, so it will never appear on the page.

Looks like a promising start, though...!

AttachmentSize
system_modules_screenshot.png18.34 KB

#2

dmitrig01 - May 11, 2008 - 06:09
Status:patch (code needs work)» patch (code needs review)

This should work properly.

AttachmentSize
system_modules_cleanup.patch22.57 KB

#3

Dries - May 12, 2008 - 01:04

The help links are no more?

#4

dmitrig01 - May 16, 2008 - 04:43

Oops...

#5

R.Muilwijk - June 29, 2008 - 20:41
Status:patch (code needs review)» patch (code needs work)

Helps is indeed gone

#6

dmitrig01 - July 4, 2008 - 15:56
Status:patch (code needs work)» patch (code needs review)

Here are the "more help" links.

This patch will greatly help me do my install-profiles-as-modules, which I don't really even want to mess with until this gets in.

AttachmentSize
system_modules_cleanup-229129-6.patch23.09 KB

#7

catch - July 4, 2008 - 16:24
Status:patch (code needs review)» patch (code needs work)

This seems to break the theming/grouping at admin/build/testing for some reason.

Also looks like tests need updating: Module list functionality: 40 passes, 25 fails, 1 exception

And I get the following notice after tests run: warning: Invalid argument supplied for foreach() in /modules/simpletest/drupal_web_test_case.php on line 862.

#8

dmitrig01 - July 4, 2008 - 16:45

Yep, I got those too, I jsut noticed. This was a bug in the patch itself. However, it deosn't seem to break the theming/grouping for me. Try this new patch

AttachmentSize
system_modules_cleanup-229129-8.patch26.15 KB

#9

dmitrig01 - July 4, 2008 - 16:45
Status:patch (code needs work)» patch (code needs review)

#10

catch - July 4, 2008 - 17:14

theming seems to have been a cache issue, I thought saving the modules page rebuilt the theme registry, but maybe not. Either way it works with the new patch.

System tests pass as well now (and no new failures anywhere else).

Only took a very quick look at the code, but 3 files changed, 209 insertions(+), 278 deletions(-), very nice.

#11

pwolanin - July 4, 2008 - 19:34
Status:patch (code needs review)» patch (code needs work)

I have cvs_deploy and since it's not part of a package, I get a notice:

notice: Undefined index: package in modules/system/system.admin.inc on line 667.

Before the patch, such modules were grouped under "Other"

#12

dmitrig01 - July 5, 2008 - 00:37
Status:patch (code needs work)» patch (code needs review)

Try this.

AttachmentSize
system_modules_cleanup-229129-12.patch26.59 KB

#13

dmitrig01 - July 5, 2008 - 00:46

Oops, Other was getting run through t() twice.

AttachmentSize
system_modules_cleanup-13.patch26.29 KB

#14

pwolanin - July 5, 2008 - 01:42

Maybe it would be better to modify module_rebuild_cache, such as:

Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.120
diff -u -p -u -5 -r1.120 module.inc
--- includes/module.inc 13 May 2008 17:38:42 -0000 1.120
+++ includes/module.inc 5 Jul 2008 01:42:21 -0000
@@ -99,10 +99,11 @@ function module_rebuild_cache() {
   // Set defaults for module info
   $defaults = array(
     'dependencies' => array(),
     'dependents' => array(),
     'description' => '',
+    'package' => 'Other',
     'version' => NULL,
     'php' => DRUPAL_MINIMUM_PHP,
   );

   foreach ($files as $filename => $file) {

#15

dmitrig01 - July 5, 2008 - 01:58

Ok, here's a patch which does this.

AttachmentSize
system_modules_cleanup-229129-15.patch26.67 KB

#16

dmitrig01 - July 5, 2008 - 20:21

As per chx: rename _system_modules_build_extra to _system_modules_build_row, and add lots of comments.

AttachmentSize
system_modules_cleanup-229129-16.patch29.23 KB

#17

chx - July 7, 2008 - 19:28

I very much like this. It's quite a bit cleaner than the current code (for which I am partially responsible for).

#18

dmitrig01 - July 8, 2008 - 06:08

Per litwol: move #headers into the form definition itself, so altering the form becomes easier.

AttachmentSize
system_modules_cleanup-229129-18.patch29.52 KB

#19

dmitrig01 - July 8, 2008 - 06:11

Oops, in-consitiency between #header and #headers, went with #header.

AttachmentSize
system_modules_cleanup-229129-19.patch29.55 KB

#20

dmitrig01 - July 20, 2008 - 06:46

(bump)

#21

webchick - July 20, 2008 - 19:36
Status:patch (code needs review)» patch (code needs work)

No longer applies.

#22

dmitrig01 - July 21, 2008 - 08:10
Status:patch (code needs work)» patch (code needs review)

crap, re-rolled

AttachmentSize
system_modules_cleanup-229129-22.patch29.75 KB

#23

moshe weitzman - July 22, 2008 - 18:05

Even after this patch, this is still some ugly code IMO. The dependency checking ought to be split off into helper functions so it isn't tied into form building. That would be a big help to drush.module and any upcoming 'auto-install via php' module. That can wait for a follow-up patch though.

#24

Dries - July 23, 2008 - 07:38
Status:patch (code needs review)» fixed

I had another look at this patch and it looks a reasonably good clean-up indeed. The reason it took this long to commit this patch is for reasons outlined by Moshe -- although it is a clean-up, it is still reasonably messy. Moshe's comment triggered me to look at it again, and to push it over the edge. Hopefully we'll see more clean-up patches.

Thanks dmitri. Good job.

#25

Arancaytar - July 23, 2008 - 14:05
Status:fixed» patch (code needs work)

Edit: Rewrote report more accurately.

1.) This patch causes notices for modules which do not declare a package. That is true for a lot of contrib currently. If Drupal 7 intends to make package a required value, remember to update the docs accordingly.

2.) The patch removes core compatibility warnings. If a module is incompatible with the core version, the checkbox will correctly be replaced with a stop sign, but the sentence This version is incompatible with the 7.0-dev version of Drupal core. fails to appear. Related to that, the concatenation in system.admin.inc:776 (which appends this message) causes a notice because it appends to an undeclared variable.

This could have been avoided with some more thorough testing.

#26

Arancaytar - July 23, 2008 - 14:12

Replace the key #value with #markup in system.admin.inc:776. Easy change, fixes the notice and the missing compatibility warning. The other one will probably need some isset() or other.

#27

catch - July 23, 2008 - 14:16

Note that this was also brought up in #11.

#28

TapocoL - July 23, 2008 - 17:30

I accidentally posted a new issue about the undefined index notices. As I was about to post another I searched a little deeper, and thought I should post them in here. Other issue: http://drupal.org/node/286351

AttachmentSize
user.admin_.inc_.patch937 bytes
filter.admin_.inc_.patch713 bytes

#29

Arancaytar - July 23, 2008 - 18:05

No you shouldn't have, your issue is unrelated to this one, even though it is a similar mistake. This patch affects only system.admin.inc, not user.admin.inc or filter.admin.inc.

#30

Arancaytar - July 24, 2008 - 19:44
Title:Clean up system modules page» System module page has notices, version incompatibility not shown.
Category:task» bug report
Status:patch (code needs work)» patch (reviewed & tested by the community)

Problem identified.

1.) Dries committed only part of the patch in #22. modules/system/* was committed, but includes/module.inc was not. Once this file is committed, the "package" notice will vanish.

2.) #value was mistakenly used instead of #markup in system.admin.inc. The patch I am uploading now fixes this. After that, the other notice will vanish and version incompatibility warnings will reappear.

My patch includes the fix to both files.

AttachmentSize
system-modules-broken-229129-30.patch1.51 KB

#31

Damien Tournoud - August 13, 2008 - 22:32
Title:System module page has notices, version incompatibility not shown.» System module page *seriously* broken
Status:patch (reviewed & tested by the community)» patch (code needs work)

On top of the two bugs outlined in #30, the system module page is now *seriously* broken:

  • Required core modules can now be disabled,
  • Checkboxes for dependant modules are not checked,
  • When submitting the form, the confirm page *always* appear as soon as there is one dependency relationship between enabled modules, and even if all the modules in the relationship are enabled.

Looks like this was not tested enough. Granted, that form is really messy.

#32

boombatower - August 15, 2008 - 00:40

subscribing

#33

Dries - August 15, 2008 - 07:53

Let fix this and submit tests with it. That will learn us to test it better.

#34

swentel - August 17, 2008 - 14:51

2 more things:
1) if your .info file does not have the files[] line, registry throws a php notice and warning, see http://drupal.org/node/274232 I think we should add this to the compatibility check just like we check for the core line.
2) system.admin.inc, line 783 has a #value, should be #markup. This throws a php notice also.

 
 

Drupal is a registered trademark of Dries Buytaert.