Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
system.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 May 2010 at 21:14 UTC
Updated:
19 Sep 2010 at 15:40 UTC
Jump to comment: Most recent file

Comments
Comment #1
damien tournoud commentedEasy patch.
Comment #2
Bojhan commentedsubscribing
Comment #3
yoroy commentedWhat is the expected sort? Alpha? or 'Core' first then the rest alpha? I can test but can't tell what the desired outcome is.
Comment #4
damien tournoud commentedCurrently the list is not sorted at all (the fieldsets are in the order of the groups when ordering modules by alphabetical order).
In #1, I just restored Drupal 6 behavior: sort fieldsets alphabetically (more precisely: using natural sorting, so that numbers are ordered as expected, "Test 10" being after "Test 9").
Comment #5
Nick Lewis commentedAccidentally patched the same issue. Merely reimplemented a ksort at the fieldset ordering point that used to live a d6 function (details: http://drupal.org/node/810484#comment-3022872).
Here's the patch's changes in full:
While it doesn't handle situations where you need to order Test 9 vs Test 10 i don't know of a situation where that will be a problem... My two cents, better to have plain old ksort - simple - easy to follow - and easy for us to rip out when we destroy the modules page anyways in d8.
Comment #6
dwwI think the strnatcasecmp() is fine, and either way is just as "easy to rip out" later if needed. However, we should add a test for this bug. Then this is RTBC.
Thanks,
-Derek
Comment #7
Nick Lewis commentedstrnatcasecmp() isn't the issue (but damned if that's not a beautiful traditional PHP function's name).
My only issue is that we're using a uasort callback to do the job of ksort, and I don't really think its necessary. I wouldn't *really* care had I not learned about the wonderful history of uasort callbacks in system.admin.inc tonight.
You see this function is going to be the 3rd of a set of strange uasort callback functions we're throwing around in the system.module
Our friend element_sort_by_title($a, $b) will be joining a much older function seen below:
Don't be fooled by system_sort_modules_by_info_name's documentation however... he does not sort themes. Themes long ago rebelled with their own uasort function:
Likewise, the documentation lies: this is the theme's uasort function, and doesn't touch modules.
***
ksort did the job fine in d6 -- that's all the we lost btw, a single ksort in a theme function -- that's what caused the bug. Its one line. And doesn't add yet another weird uasort function to system.module. Again, i wouldn't care if there wasn't already a comedy of uasort functions already in the system.admin.inc.
Either way I'll support the patch. Just saying... I freaking hate code...
Comment #8
damien tournoud commentedelement_sort_by_title is not in the system module. It is designed as a general purpose way of sorting structured element by title.
Comment #9
Nick Lewis commentedWell, the module page is broken. I'll take Damien's patch any day -tests or no tests. I don't think it was a good idea to organize them by packages in the first place. But that's another story (hint, involves sortable tables with a packages column)
Comment #10
webchickIt's pretty stupid (but not release-blocking stupid) to have "Other" at the top, so we should fix this.
Comment #11
aspilicious commentedHmm, was thinking the same, looks kinda crazy...
I prefer yoroy's proposal to put core on top and list the other modules by alphabet.
If that isn't an option we should order it by alphabet
Option 1
--------
Core
Ape Module
Grandmother Module
Zulu Module
Option 2
--------
Ape Module
Core
Grandmother Module
Zulu Module
If you choose for option 2 you still going to have some silly modules being in front of core
Comment #12
jbrown commentedI think the Core fieldset should be at the top.
Comment #13
webchickYep, let's do Option 1. Basically, same as D6.
Comment #14
sunI've tried to write a test for this, but cannot cleanly replicate the bug in the testing environment, i.e., in a way that a package comes before or after "Core", but shouldn't. As Damien already mentioned, "Currently the list is not sorted at all (the fieldsets are in the order of the groups when ordering modules by alphabetical order)."
When adding arbitrary modules into sites/all/modules, however, then you start to see disorder.
I'd recommend to simply commit this patch. Regardless of whether it's possible at all or not, this is also one of the cases where writing solid tests is much more complex than quickly identifying + fixing the tiny bug.
The added element sorting helper function is very helpful.
Attached patch additionally moves the "Core" package to the top, as requested above.
Comment #15
jbrown commentedGreat!
Modules that don't have a package defined are automatically in "Other".
The "Other" fieldset should come last.
Comment #16
sunI wouldn't necessarily agree with that. But anyway, if we'll additionally do that, then putting a switch into the loop is not very clean; instead, we'd want to put two isset() conditions + #weight definitions after that entire thing, right before the uasort().
Comment #17
jbrown commentedThe "Other" fieldset really means "Uncategorised" or "Miscellaneous" - so I think it should be at the bottom.
We only need an isset for "Other", as "Core" is always present.
Comment #18
sunStill not sure whether I agree with that. Although I also don't really care, since I believe we need to totally revamp that page anyway, entirely removing/replacing "packages".
Nope, "Core" can vanish via hook_system_info_alter().
Comment #19
Bojhan commented@sun agreed, but totally unsure, now is the good moment to do that.
Comment #20
jbrown commented@Bojhan - for D8 you mean?
Comment #21
sunPlease wait for green.
Comment #22
dries commentedPersonally, I think 'Other' is a poor name. I guess we should debate 'Other' in a different issue. Core vs Other makes sense for developers, but less so for developers that want to enable features. Anyway, different issue.
Comment #23
jbrown commented#20: modules-page-order.patch queued for re-testing.
Comment #24
webchickMmmm. I'm not comfortable changing where "Other" appears in the list at this late stage. We can think about testing and evaluating that for D8. And yes, changing the title of the "Other" fieldset would be another issue, and also probably a D8 thing at this point, since it's been named that since D..5?
Committed #14 to HEAD.