Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
All is in the title.
This is really, really not handy to check all info files and does the work manually to check I have all my dependencies.
Is there a really good reason to this?
Comments
Comment #1
boombatower CreditAttribution: boombatower commentedSimpleTest manually sets everything up...not sure if the admin/build/modules code is abstract enough to allow use to call it like that.
Just uses module_enable|disable().
If we decide to add this it should be done in D7 and backported.
Comment #2
pounardOk, thanks for the answer.
I think you really should consider handling module dependencies, maybe based on simpletest'ed code to be sure there is no side effects!Sorry misreading of what you said.Comment #3
Freso CreditAttribution: Freso commentedAnd
module_enable()
doesn't check fordependencies
. It seems as if all the dependency checking is done insystem_modules_submit()
, using functions from includes/install.inc.Perhaps we could load install.inc and use
drupal_install_modules()
instead ofmodule_enable()
?(Also, I'm not sure where I can find the source code for
setUp()
.)Comment #4
boombatower CreditAttribution: boombatower commentedDrupalWebTestCase overrides the Drupal 7 DrupalWebTestCaseCore.
Comment #5
Freso CreditAttribution: Freso commented@ boombatower: I'm sure you're right... I'm just not sure what that has to do with anything here. :) Please elaborate?
Comment #6
boombatower CreditAttribution: boombatower commentedSorry, I was thinking of D6 (too many version...).
In Drupal 7 the code is located in the DrupalWebTestCase (drupal_web_test_case.php) in the SimpleTest module (modules/simpletest).
Comment #7
sndev CreditAttribution: sndev commentedboombatower,
First off, awesome work on the entire Drupal testing suite. Instead of writing the 10 module names in my setUp() function I wrote a script to take care of it for me. I have tested it in 6 and a few tests in 7. The only thing that worries me is rebuilding the module data every time the setUp is run. Correct me if I am wrong, but wouldn't that increase the running of a single test considerably?
Thanks again for all your work.
Comment #8
sndev CreditAttribution: sndev commentedComment #9
boombatower CreditAttribution: boombatower commentedConsidering how many times setUp is run it may increase the overall run time.
I would think a function like this should exist in core instead something like a system function that simpletest can call, either way not sure this is going to make it in d7. You should probably ask webchick/Dries about that.
Comment #10
sndev CreditAttribution: sndev commentedI agree that it should be system function, but my assumption would be that the only time this would be called is during the loading of admin/config/modules and you would definitely want to refresh the module cache. With that assumption in mind, it isn't really necessary to separate the dependency discovery phase from the actual form creation/validation/submission. In Simpletests situation, there should be no additional modules that are added after the initial setup of the system table. Could we load the dependencies array once and have them available for all tests?
Comment #11
boombatower CreditAttribution: boombatower commentedIf I understand you right, that sounds good. I still think that having functions to determine these things are handy, makes it much easier for contrib (or us in this case) to come along and use data that the system already knows about, but either way works.
Comment #12
sndev CreditAttribution: sndev commentedAfter looking at the code a little longer, I think there will be minimal increase in test time using the module_rebuild_cache and system_rebuild_module_data functions respectively. The reason being that every time drupal_install_modules function is run, it too calls one of the two functions.
At the same time, I think increasing efficiency is always a good thing. Other then running the first test separately to extract the dependencies array, how would you carry over the array between tests?
Comment #14
carlos8f CreditAttribution: carlos8f commenteddrupal_install_modules() is the function already in use in D7 that resolves dependencies, so listing them in a D7 MyTestCase::setUp() is not necessary. I verified this by removing taxonomy and comment from ForumTestCase::setUp() with tests passing.
I'm not sure why this issue is experienced in D6, since D6 has a corresponding drupal_install_modules() and D6 setUp() is using that. I haven't verified it since I don't have a D6/simpletest dev install handy. Might this be a bug in the D6 version of drupal_install_modules(), or enable_modules()?
Also, from D6 SimpleTest:
This looks bad. drupal_install_modules() is supposed to resolve dependencies, so dependencies listed by the test will get double-processed. If there is a problem with drupal_install_modules() not enabling dependencies, or problems with the module list not refreshing, we seem to have an issue in D6 core. Am I missing something?
Comment #15
sndev CreditAttribution: sndev commenteddrupal_install_modules does not resolve dependencies. Put a debug($module_list) statement at line 560 of the install.inc in D7 and you'll see that it doesn't return any dependencies. It's job, I think, is to order the list of modules based on their dependencies, but doesn't do any checks of the dependency (whether it is installed, exists, etc.). Drupal's module installation process is very dependent on the admin/config/modules form. All dependencies are resolved in the validation/submit function of that form.
The reason why your test worked is because taxonomy and comment are included in the base install during a simpletest. If you add a dependency to the forum.info file like profile (not part of the base install), it is not installed as a dependency of forum until you add it to the ForumTestCase::setUp().
D6 has the same problem.
Comment #16
sndev CreditAttribution: sndev commentedComment #17
carlos8f CreditAttribution: carlos8f commentedOops. I consider it a bug that drupal_install_modules() allows that to happen -- when it has the module data to work with and can easily add dependencies to the list. Failing to do this can put the system in an inconsistent state, which should be avoided if possible.
Also, due to improvements in D7 enable_module(), I don't think it's necessary to install each module one-by-one anymore. See http://drupal.org/node/472684#comment-1637074. This avoids the system_rebuild_module_data() call for each listed module.
Comment #18
moshe weitzman CreditAttribution: moshe weitzman commentedCan we move or remove code from the validate and submit handlers on the modules form? This movement of code out of the submit handlers woud be helpful for non interactive requests such as drush commands.
Comment #19
carlos8f CreditAttribution: carlos8f commentedI guess the question is whether it's useful to abstract the logic into (module|system|drupal)_resolve_dependencies(array $module_list) which just expands the module list, or have drupal_install_modules() (especially post-API freeze) take care of that transparently, as I did in the patch. If the dependencies need to be enumerated to prompt the user, the code in place on the module form is fine to do that, but could be removed at some point if we add a resolve_dependencies()-type function. In SimpleTest's case no prompt is necessary and it's really trivial to just add the dependencies in drupal_install_modules().
Comment #20
sndev CreditAttribution: sndev commentedNice solutions Carlos. I think trying to tackle the entire module install process is a bit over doing it, but the solution you suggest will work for non-system module installs like drush and simpletest. I think the only thing you could improve is including a more detailed error response. Maybe an error array that includes module name and module parents.
Comment #21
carlos8f CreditAttribution: carlos8f commented@sndev, drupal_install_modules() shouldn't return an array on an error, neither should any function IMO. It would evaluate to TRUE and is misleading as a failure. The return FALSE part is mostly to abort the process, but I have now added a return TRUE to balance that. Since this is still a fairly low-level function a detailed error report would be out of scope.
I also added tests for dependency resolution. The tests use hook_system_info_alter() to create dependency chains, and then test if drupal_install_modules() resolves those dependencies and avoids installation due to a missing module.
Comment #22
moshe weitzman CreditAttribution: moshe weitzman commentedI love the new tests. This is RTBC. Thanks for making module installation more robust.
Comment #23
webchickWow, nice! I like this very much. I too have been bitten by this writing tests in D6, and would appreciate Drupal doing this particular thinking for me. ;P
Committed to HEAD. I'm not sure that we can back-port this to D6 since it's changing both the behaviour of the function and the API slightly. But marking for portage anyway, just in case.
Comment #24
moshe weitzman CreditAttribution: moshe weitzman commentedOy. I think this made life harder for drush enable. Now it really does have to order its modules correctly before calling drupal_install_modules(). ANd the code for ordering is not reusable. Is in system_modules_submit(). Perhaps carlos8f wants to become a hot new drush developer and investigate pm.drush.inc in drush?
Comment #25
carlos8f CreditAttribution: carlos8f commented@moshe, drupal_install_modules() is supposed to order dependencies before dependents, and my patch shouldn't have changed that. Can you give me an idea on how to reproduce the problem?
Comment #26
sndev CreditAttribution: sndev commentedOutside of the normal module installation process, how would you figure out what the dependency problem is without some sort of error response? Also, since you are tackling the dependency check in the drupal_install_modules function, shouldn't you move requirements and version checks into the function as well?
Again, this is a great first step. Kudos on the test addon.
Comment #27
sndev CreditAttribution: sndev commentedsry about that
Comment #28
carlos8f CreditAttribution: carlos8f commented@sndev, I'm working on a drupal_resolve_dependencies() function, which might do what you have in mind. I'll cross-link an issue if I get it working. Ideally this would centralize dependency resolution logic and replace what we have in the modules page, drush pm, and in drupal_install_modules(). It would be tricky to have this API satisfy all the existing use cases, but I think it's worth a try.
Comment #29
webchickmoshe, could you write a test case that reproduces the problems pm.drush.inc is seeing? Or instruct someone else on how to write them?
Comment #30
Damien Tournoud CreditAttribution: Damien Tournoud commentedI guess that this code somewhat work, but there are no proof (the fact that modules are ordered correctly is not tested), and it needs to be refactored.
The code of drupal_install_modules() is very convoluted right now, but should be really dead simple:
(1) iterate over $module_list and add build a list of all the modules + their dependencies
(2) sort the list of modules to be installed according to $file[$module]->sort
(3) install and enjoy
Something like this should do it:
This said, I think we should move that logic to module_enable(), and deprecate drupal_install_modules(). That later function serves exactly zero purpose.
Comment #31
carlos8f CreditAttribution: carlos8f commented@Damien, you're right, it seems that the sort property works just fine. Your array_pop() method also looks elegant. Having this in module_enable() would be preferable, but I could also see it being useful abstracted to something like,
to then be used with the module page interface, drush pm, etc. The $info array might have keys like 'added', 'removed', 'missing', 'incompatible', etc. to facilitate prompts to the user.
I'm also wondering if improvements to this should be better done in a follow-up issue, since we're also looking at backporting at least the simpletest aspect to D6.
Comment #32
Damien Tournoud CreditAttribution: Damien Tournoud commented@carlos8f: we can discuss improvements, but those are clearly D8 material. For now, we need to fix D7.
Comment #33
hanoiisubscribing
Comment #34
carlos8f CreditAttribution: carlos8f commentedre: fix D7, what is currently broken? Other than that drupal_install_modules() is a lame wrapper around module_enable() :-p
I created two possible refactors:
one of drupal_install_modules() only, paraphrasing Damien's code by using the sort property and a simpler loop style.
The alternate refactor embeds logic in both enable_modules() and disable_modules(), to ensure that modules are *never* enabled or disabled out of order or without dependencies/dependents. drupal_install_modules() is reduced to a deprecated wrapper.
I realized that the order and dependents are significant for disabling modules as well. The second approach, while making things consistent, might come at a performance price since it uses system_rebuild_module_data(), a fairly expensive function. Therefore module_enable/disable() shouldn't be sprinkled all over the place but rather used with a batch of modules if possible.
Also, I assume that after switching to the sort property for ordering, tests are then covered by graph.test.
Comment #35
carlos8f CreditAttribution: carlos8f commentedFixed some weirdness in system.install hunks.
Comment #36
carlos8f CreditAttribution: carlos8f commentedIf we can tweak the API a bit, perhaps a $do_the_dependency_check flag to module_enable/disable(), probably defaulting to TRUE, would allow the $module_list to be passed as-is, if checks have already been done for dependencies.
Comment #38
sndev CreditAttribution: sndev commentedCarlos, it looks like you've been doing a lot of work on this problem. As I see it, there are quite a few checks that need to occur before any module install (except for profile install?).
* Exist
* Status
* Requirements
* Install Order
* Dependencies
Can all of these be done from the drupal_install_modules function? Yes. Should they be done from it? I don't think so. Unless the powers that be will allow a revamp of the system.module and the entire module install processes. Otherwise, you will just be replicating functionality that already exists. I think time would be better served revising the simpletest module install process and pm.drush.inc or creating an API that they can tap into. Your solution solved the original issue I was dealing with, but helped reveal some inherit problems with the module install process for none system.module situations. Good luck.
Comment #39
carlos8f CreditAttribution: carlos8f commentedI implemented the flag mentioned in #36. By default the $module_list is used as-is, which I think is sane. This can be left as an optional feature used with simpletest cases, drush pm, etc.
Comment #41
moshe weitzman CreditAttribution: moshe weitzman commentedI tested this out and it works perfectly. And the code is clearer now. Well done. This has been a buggy bowl of spaghetti for a long time.
Attached patch has these minor changes
I still don't love how we install a bunch of modules and then enable a bunch of modules. I would do install+enable for a give module and then continue on to the next. But thats a different patch. That patch will be simpler after this is committed.
Comment #43
carlos8f CreditAttribution: carlos8f commentedI think the $check_dependencies flag should default to FALSE, and we can just turn it on for SimpleTest in core. Everywhere else we are manually checking dependencies.
My patch also has a weird quirk, hook_boot() apparently isn't getting invoked or so the test says. I tried reverting a bunch of stuff but can't nail it down yet. I'm not positive that my refactor of the lower half of module_enable/disable() accounts for everything, so I may end up reverting that also.
Comment #44
carlos8f CreditAttribution: carlos8f commentedI tracked down the hook_boot() bug, and it revealed an even weirder way in which drupal_install_modules() convolutes things. It seemed like drupal_install_modules() was calling system_rebuild_module_data() primarily to sort the module list, but it turns out SimpleTest was relying on that also to refresh the bootstrap column in the system table. It probably makes more sense to remove the bootstrap column logic from system_rebuild_module_data() and place it at the end of enable/disable_module(). After doing that, the boot hook fired and tests passed.
Comment #45
moshe weitzman CreditAttribution: moshe weitzman commentedMoving that code as per #44 sounds good to me.
Personally, I think module_enable() should return an error message when it can't complete the enable. Search @return in file.inc and you will see that it is somewhat common for TRUE/FALSE functions to return an error message if needed. Not a big deal though.
Comment #46
carlos8f CreditAttribution: carlos8f commentedI intend on posting a new patch in the next few days. Got sick and now working on my real job projects :-/
Comment #47
carlos8f CreditAttribution: carlos8f commentedThis incorporates moshe's edits. To summarize, this patch:
- Removes drupal_install_modules() since it doesn't do anything important.
- Incorporates dependency resolution and ordering into module_enable(), available with an optional flag, $check_dependencies. Interfaces that take a list of modules, such as DrupalWebTestCase::setUp(), or drush pm can use this flag to auto-process $module_list and not worry about that stuff.
- Abstracts bootstrap status update logic to a new function, system_update_bootstrap_status(). The reason is because it's necessary to call this after module_list() has changed, but it's not necessary to do a full system_rebuild_module_data(), where the logic currently lives.
Comment #48
moshe weitzman CreditAttribution: moshe weitzman commentedWell done. Code looks good, and bot is pleased.
I'm hoping this one can go in quickly. We then need to merge the install+enable stages when enabling a bunch of modules. I mentioned this at end of #41.
Comment #49
webchickGiven the point where we are in the cycle, I'd prefer to see this fixed without changing APIs. If that leaves drupal_install_modules() as a dumb wrapper around module_enable() that we immediately remove in D8, then so be it.
Why does $check_dependencies default to FALSE? Backwards compatibility..? It seems like it is indeed called more often with that set to FALSE, but I'm curious if developers would expect it to check dependencies by default.
I had to read this a couple times to figure out why a ! condition would return TRUE. A one-liner comment here would help.
Pedant time! Can you compress this so it fits into 80 chars? Else split on multiple lines.
Powered by Dreditor.
Comment #50
moshe weitzman CreditAttribution: moshe weitzman commentedHopefully addressed all concerns:
1. Put back drupal_install_modules() as a thin wrapper around module_enable(). This is what carlos8f did originally.
2. Yes, I do think this is kind of a backward compatibility. I think you can make an argument either way here. Lets just leave it, or else we have a confusing situation where drupal_install_modules() will have different defaults from module_enable(). drupal_install_modules() should not start testing for dependencies all of a sudden.
3. Added one liner.
4. Shortened function summary.
Comment #51
moshe weitzman CreditAttribution: moshe weitzman commentedFixed one letter typo in system.module doxy.
Comment #52
webchickUgh. Sorry. One more.
It looks like $disabled_modules_installed_hook is some sort of internal property intended only for SimpleTest or something. So we should actually move this to the end, so that people wanting to trigger $check_dependencies don't end up coming across it and reading the totally non-helpful documentation and becoming horribly confused.
Otherwise, this looks good to go for me.
6 days to code freeze. Better review yourself.
Comment #53
moshe weitzman CreditAttribution: moshe weitzman commentedMoved that god forsaken param to the end. Wait for green before commit.
Comment #55
carlos8f CreditAttribution: carlos8f commentedEven if drupal_install_modules() is now deprecated, I would turn the $check_dependencies flag on here:
Otherwise it's a regression since the purpose of this function was apparently to be able to pass a list of modules (in no particular order) and have the order sorted out before sending to module_enable(). The $check_dependencies flag replaces what drupal_install_modules() used to do, so let's use it if the function won't die yet :)
6 days to code freeze. Better review yourself.
Comment #56
carlos8f CreditAttribution: carlos8f commentedoops, didn't mean to RTBC this.
Comment #57
carlos8f CreditAttribution: carlos8f commentedHere's the change from #55, drupal_install_modules() now uses $check_dependencies = TRUE to order the module list.
Comment #58
carlos8f CreditAttribution: carlos8f commentedOops, fix indentation mistake in last hunk.
Comment #60
chx CreditAttribution: chx commentedhttp://drupal.org/node/347959#comment-2447364 is at least related.
Comment #61
carlos8f CreditAttribution: carlos8f commentedI fail at re-rolling, here's a copy & paste of #53 with $check_dependencies = TRUE in drupal_install_modules().
Comment #62
moshe weitzman CreditAttribution: moshe weitzman commentedThanks for the fix. RTBC
Comment #63
sunI guess we need this due to the testbot... add a @todo or something that explains why, please?
Reading the results of this patch, I don't see why I should ever want to not check dependencies and why the default is FALSE. Either this needs heavy clarification in PHPDoc or this entire argument is superfluous.
At least the default of FALSE looks entirely wrong to me.
Same as above.
Powered by Dreditor.
Comment #64
moshe weitzman CreditAttribution: moshe weitzman commented@sun - did you read the issue or just the patch? Most of your questions have already been discussed and addrressed. If you have read the issue and still have concerns, we will address them.
Comment #65
sunI only read the patch, sorry for not stating that. This means that essential information from this issue needs to moved into code.
Comment #66
carlos8f CreditAttribution: carlos8f commentedAdded more documentation as per #63. system_rebuild_module_data() is an expensive function and the step should be skipped unless you're anticipating that $module_list needs some correcting, ala SimpleTest or drush pm.
Comment #67
carlos8f CreditAttribution: carlos8f commenteder. forgot the patch.
Comment #69
carlos8f CreditAttribution: carlos8f commentedlet's try that again :)
Comment #70
carlos8f CreditAttribution: carlos8f commentedComment #71
moshe weitzman CreditAttribution: moshe weitzman commentedthanks carlos8f. RTBC again.
I made that follow-up patch at #679336: Enable each module right after it is installed. reviews are appreciated.
Comment #72
sunWhat exactly in the D7 code freeze requires this? Sorry, but we usually do not keep anything for backwards-compatibility, so this needs a very explicit reasoning.
Not supported here.
Performance reasons? Is that all?
Really, if I do
then I expect it to fail if yay.module depends on wonky.module and wonky.module is not enabled.
What I mean is: The usual case is that you do not know whether the dependencies of a third-party module are available, respecting it's exact version; do I really know which dependencies yay.module 4.x has while only specifying just 'yay'?
If SimpleTest, the install system, or whatever skips this because it already checked it, then fine, let it pass FALSE. But please don't expect the same sanity + knowledge from average developers.
It's exactly code like this, which exists in a test here, but code like this also exists "elsewhere" -- 'Try to install a new module' says it all.
Without passing the second argument, I expect it to fail, if dependencies are not met.
Regardless of whether I enable or disable. Dependencies must always be met by default.
Unless I know what I'm doing and override the 2nd argument.
Powered by Dreditor.
Comment #73
carlos8f CreditAttribution: carlos8f commentedsun, Re: code freeze comment, moshe and I tried to get rid of the function but webchick vetoed, see comment #49. I don't think there's a good reason to leave it in either.
We could default the flag to TRUE, but then we'll have to override it for every case in core, except the one line in SimpleTest. I thought it would be odd introducing a flag that is overridden more times than not. system_rebuild_module_data() is a hog, I would definitely default this feature to 'on' if we could cache it in some way, but that's definitely beyond the scope here.
Comment #74
sunok, so we have an issue here, because we don't do this. But webchick prefers to do it now. Normally, this would mean to bump this issue to D8, but since this patch might help us (not verified) with resolving #347959: modules_installed is broken during testing, we have a slight conflict.
Regarding the default value, this only means that the code this patch changes already knows about dependencies. All other callers of this function won't. This is a public API function and I can call it anytime from anywhere, so its defaults should be sane.
Comment #75
Dries CreditAttribution: Dries commentedI'd still be OK with removing the legacy function prior to D7-alpha. Especially because we must address #347959: modules_installed is broken during testing, which might require an additional API change. I'm also happy to keep the wrapper function if #347959 doesn't require additional API changes.
Does 'processed' or 'checked' means that it will actually install dependent modules? The API documentation makes it sound as if it just checks things. It is a bit ambiguous.
Comment #76
chx CreditAttribution: chx commentedThere's what Dries asks but also, the code is completely wrong because it only adds immediate dependencies (with a weight of 0) if noone else does, I will work on this later today. It needs to call graph.inc and include all dependencies.
Comment #77
carlos8f CreditAttribution: carlos8f commentedchx, are you sure you aren't misreading the code? It does more than immediate dependencies, as evidenced by the test I wrote earlier in the issue. graph.inc is generating the sort property in _module_build_dependencies(), called by system_rebuild_module_data().
Comment #78
chx CreditAttribution: chx commented@carlos8f, you are partially right because the dependencies array is filled in by
_module_build_dependencies
but then the uniform zero weights will be wrong, some of these modules can depend on others.Comment #79
chx CreditAttribution: chx commentedThat is not so hard, quoting the patch:
if we already have the sort property then why not use it?
Comment #80
carlos8f CreditAttribution: carlos8f commentedSorry chx, I should've put a code comment before the
$module_list[$dependent] = 0;
. 0 is just a placeholder here, since the actual value gets set on the next iteration of the while loop. Your code is fine but doesn't change anything :)Comment #82
chx CreditAttribution: chx commentedThis is carlos8f's patch which was RTBC but I have added four lines of comment so that we know that's a placeholder and how this loop is supposed to work.
Comment #83
carlos8f CreditAttribution: carlos8f commentedI don't think it's RTBC quite yet, I'm working on a revision that removes drupal_install_modules(), since most of us agree there is no reason to keep it. Also defaulting $check_dependencies to TRUE, to take sun's suggestion. Most cases in core will set it to FALSE to avoid too many system_rebuild_module_data() calls. I'd also like to rename $check_dependencies to $check_dependents for module_disable(), since that is more accurate. I'll add better documentation. I'm also playing around with an idea of installing the default profile in SimpleTest in one module_enable(array('default')) call, but that might have to wait for a follow-up.
Comment #84
webchick"I'm also playing around with an idea of installing the default profile in SimpleTest in one module_enable(array('default')) call, but that might have to wait for a follow-up."
Yes, please let's not go there in this issue. I'd like to get this cleaned up and marked fixed soon since it's one more thing sitting in the critical queue taunting me. ;)
Comment #85
carlos8f CreditAttribution: carlos8f commentedOK, here I've:
- removed drupal_install_modules() altogether.
- defaulted $check_dependencies = TRUE. This errs on the side of a general-use API, and core skips this step when it knows dependencies are all met and in order.
- added inline comments to make the dependency discovery loop more clear.
This is likely the final iteration unless there are disagreements or the bot spits it out.
Comment #86
carlos8f CreditAttribution: carlos8f commentedOne more thing, I renamed $check_dependencies to $check_dependents in module_disable().... and forgot to update the 'if' statement :P
Comment #87
carlos8f CreditAttribution: carlos8f commentedRTBC unless anyone objects.
Comment #88
webchickWell, let's get an actual review. It's bad form to set your own patch RTBC.
Comment #89
carlos8f CreditAttribution: carlos8f commentedI think I addressed moshe's, sun's, Dries's, and chx's reviews, but ok :P
Comment #90
moshe weitzman CreditAttribution: moshe weitzman commentedComment #91
Dries CreditAttribution: Dries commentedI think this is 99% ready. There is room for some additional massaging.
- Wouldn't it be more clear to call it $enable_dependencies instead of $check_dependencies?
- I'd mention that there is a significant performance cost when $check_dependencies is TRUE.
- Ditto for module_disable().
It would be good to document _why_ one would want to call this function. It feels like an internal function to me.
Comment #92
carlos8f CreditAttribution: carlos8f commented- renamed $check_dependencies to $enable_dependencies
- renamed $check_dependents to $disable_dependents
- Added more to docs:
Comment #93
moshe weitzman CreditAttribution: moshe weitzman commented100% now. Please wait for green before commit.
Comment #94
sunWhy reverse?
Powered by Dreditor.
Comment #95
carlos8f CreditAttribution: carlos8f commentedReverse since the weights go "dependent" --> "independent", light to heavy. We reverse the weights to enable independent modules before the dependent ones. For disable, we use the weights as-is since needy modules should be disabled first.
Comment #96
axyjo CreditAttribution: axyjo commentedPatch applies cleanly and works for me. +1
Comment #97
webchickOk, let's put this poor issue finally to rest. Committed to HEAD.
This new behaviour and the removal of drupal_install_modules() needs documenting in the module upgrade guide.
Comment #98
sunuhm, why does http://api.drupal.org/api/function/drupal_uninstall_modules/7 still exist now?
Comment #99
carlos8f CreditAttribution: carlos8f commentedsun: the function has a definite purpose, uninstalling modules. while installation is implicit, uninstallation is always explicit and needs its own function.
Comment #100
pounardGlad to see a simple question I asked did finish on this great patch :) Thank you all.
Comment #101
sun.core CreditAttribution: sun.core commentedComment #102
carlos8f CreditAttribution: carlos8f commentedIt would still be nice to get dependency resolution for D6 SimpleTest. We could use something similar to #12 to avoid API changes.
Comment #103
JacobSingh CreditAttribution: JacobSingh commentedThis fun little bug wasted a good portion of my day.
_drupal_install_module never gets run in module_enable if you haven't included the install.inc library. Since it is required to run this function, it should be there.
Comment #104
JacobSingh CreditAttribution: JacobSingh commentedComment #105
chx CreditAttribution: chx commentedOoof. That's some omission. (I know my reviews are too short but honestly, what the review should be? That we have 73 include_once vs 129 require_once commands in core and we should decide at one point? But that's not this issue.)
Comment #106
catchs/_drupal_install_module/_drupal_install_module()
otherwise agreed on RTBC.
Comment #107
JacobSingh CreditAttribution: JacobSingh commentedHere's the doc updated.
Btw, is it wise to use array_filter here?
array_filter is really (IMO) meant for something which doesn't *do* anything, it just determines if each thing should be in the array.
Saving 2 lines of code here seems like a wtf. Disk space is cheap! We can spring for that extra Kb :)
I spent an hour just trying to figure out where the install function was being called because I expected something like:
// HERE IS THE INSTALL CODE
$success = drupal_install_module($module);
// END INSTALL CODE!!!! This is a big deal!!!
Besides just being a general style gripe, if it had been a normal function call in a for loop, it would have thrown a fatal, which is what I would have hoped to have thrown.
Anyway, that doesn't need to happen now, but we ought to commit.
Comment #108
carlos8f CreditAttribution: carlos8f commentedNice catch.
It took me a while also to understand that the array_filter() is actually what installs modules, at first glance it just looks like a funky array diff of $module_list. It would be much more readable to do something like:
Refactoring can come later though. There are plenty of places in core that could use good redo.
Comment #110
moshe weitzman CreditAttribution: moshe weitzman commentedanyone up for re-roll? i don;t see how this is critical anymore.
Comment #111
carlos8f CreditAttribution: carlos8f commentedre-roll
Comment #112
moshe weitzman CreditAttribution: moshe weitzman commentedComment #113
carlos8f CreditAttribution: carlos8f commented"I" in "Index" got cut off
Comment #114
moshe weitzman CreditAttribution: moshe weitzman commentedComment #115
webchickCommitted to HEAD. Thanks!
Comment #117
PatchRanger CreditAttribution: PatchRanger commentedAs the issue has "needs backport to D6" tag, here is the patch for D6.
No tests at all, because they have to be placed separately at standalone Simpletest project.
I've tested it locally - and it looks fine. Let's see whether it makes all existing tests passed.