Closed (fixed)
Project:
Drupal core
Version:
4.7.0-beta2
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
31 Dec 2005 at 18:36 UTC
Updated:
23 Jan 2006 at 11:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
chx commentedComment #2
chx commentedKeeping up w/ HEAD.
Comment #3
chx commentedComment #4
killes@www.drop.org commentedI think this is an evil hack that lacks transparency. If we want to be able to sort the order of invoked hooks we should do it the right way and offer sorting on some admin page.
Comment #5
markus_petrux commentedThere is another thing related to the way admin/modules work, that often needs to increase the PHP memory limit. It is that all modules need to be loaded in order to get access to their hook_help, etc.
Maybe it would be nice to normalize the README.txt file provided by modules in a similar way WordPress plugins/themes work. That is, the module name, version, description, could be placed on a text file that could be loaded and parsed instead of including the PHP code itself. Then, you could also add a field to specify something like "this module should be loaded after this one, if present" or something of that sort.
I already commented something about it here (just for self reference):
http://drupal.org/node/39647#comment-58934
Comment #6
chx commentedTo everyone who think this is a hack (evil or not): I would be happy to display the order on admin/modules (even with an indent) and we will be sorry if we release 4.7 without any form of ordering possibility -- there is much on hook_form_alter now so modules needs to order.
Comment #7
gerhard killesreiter commentedI we want ordering of hook invocations (and I do) we need to do it right. That is, by adding a weight for each module. I know that our weighting interface sucks, but that is unrelated and needs to be dealt with separately.
Comment #8
chx commentedSo, you want this? Form API made this easy...
Comment #9
chx commentedComment #10
chx commentedOh wait, this is not so simple any more :)
Comment #11
killes@www.drop.org commentedYesss.
Some remarks:
the new field is still called depth in database.*
the change in function system_modules seems not needed.
I guess we should add some help text.
Comment #12
chx commentedComment #13
chx commentedindexes were created on depth.
Comment #14
dopry commentedThe concept is nice.
I'm using it to order things getting called via form_alter.
Drumm brought up some good points about more specific ordering systems specialized to their tasks.
It looks like you're leaving a stray asort in modules_list, which breaks the functionality of this patch altogether.
Comment #15
chx commentedGood catch.
Comment #16
moshe weitzman commentedmuch needed, and very drupalish. code looks good. i haven't tried it yet.
Comment #17
markus_petrux commentedSince you're now ordering by weight+filename, you may want to add filename to the new key of the system table. I believe it may save an internal SQL sort.
Comment #18
dries commentedMuch needed, but do we want people to reorder modules themselves?
Do you know of any other software that lets the end user tweak stuff like this?
This is going to confuse the hell out of people, and there is no mention of it in the help text?
How do we explain this to the user?
Do we really want such a prominent GUI option for this?
Comment #19
markus_petrux commentedAs en example, if you create a module that need to redefine a menu callback, then you would love this feature so you can write in the INSTALL.txt file a step such "enabling this module and change its weight so it's ordered after module xxx".
For instance, the LDAP integration module uses a mini-module named "zcallbacks" to redefine user/login.
I hope that makes sense.
Comment #20
chx commentedNow. I first created a solution without a GUI. You folks called that hackish. Now I provide one that's clean. That's too much. What I am to do? Keep the weight field and remove the weight fields? That's easy, commit without the system module hunks.
Comment #21
Cvbge commentedDear Chx. We called your directory solution hackish.
Comment #22
dries commentedchx: nothing to worry about. I'm just polling for opinions on the GUI changes, and will commit the proper patch accordingly.
Comment #23
Crell commentedModule order dependency should never even make it to the GUI.
If Module A requires that Module B run before it, then that is true at all times. The user shouldn't be able to change something and break that.
If Module A doesn't care when it runs with respect to Module B, then there's no reason why the user should be able to change it since it would have no effect.
Whatever the solution, it should be code-based, not UI-based. Nothing good can come of users futzing with module order.
Comment #24
moshe weitzman commentedCrell - you'd be a fan of http://drupal.org/node/5491
IMO, this isnt about dependencies. We are usually talking about reordering visible elements like a list of links or a list of fieldsets such as what appears at end of the node form
I'm fine with weight showing on admin/modules. If that seems distasteful, take chx's patch without the system.module piece and let a contrib module provide the UI.
Comment #25
chx commentedWell, I am convinced now that it is better without an UI, let the modules tinker system table themselves. Indeed, a simple module could use form_alter to add weight fields and change the #theme of the whole form.
Comment #26
chx commentedComment #27
moshe weitzman commentedwow chx. thats a clever use of form api 9add weight fields and change $theme. i hadn't thought of that.
Comment #28
dopry commentedconditional +1
as a dev tool and a temporary thing for 4.7.
I agree with drumm's comments about more task oriented ordering in http://drupal.org/node/5491. This is a sledge hammer for situations like upload processing, where you may want things to have an effect in different order per node-type, and may cause conflicts if several nodeapi modules are written to be dependent on execution ordering.
That said, I've already found two uses for this patch...
1) ordering form creation(access the upload form to add more fields).
2) handling post processing uploads (generation of file derivatives on submit).
Its working fine... haven't found any problems yet... going live with it on a site tomorrow.
Comment #29
chx commentedLet's get this in... the use case I know of: changing the taxonomy form.
Comment #30
dries commentedPatch no longer applies. Sorry.
Comment #31
killes@www.drop.org commentedre-rolled
Comment #32
dries commentedCommitted to HEAD. Thanks for the quick reroll.
Comment #33
chx commentedOpsie I broke Drupal all over. update.php loads, bootstraps which in turn tries to enumarate modules which ORDER BY clause will die. Need to do this before the full bootstrap. Not that hard.
Comment #34
chx commentedi frogot toi rerol bfr submit
Comment #35
chx commentedComment #36
chx commentedComment #37
chx commentedComment #38
chx commentedComment #39
dries commentedCommitted to HEAD. Thanks.
Comment #40
dries commented