A standard practice of mine is to use hook_update_N() to trigger installation of new modules, e.g.:
function mymodule_update_7100() {
$modules = array('new_module', 'another_module');
module_enable($modules);
}
Recently, though, probably since around 7.19, this hasn't been working - the modules aren't enabled and they must be manually enabled instead. For comparison sake, using Drush to enable the modules does still work.
I have not yet tried replicating this on a bare core installation, to verify it isn't something else causing the problem, but I will.
Comments
Comment #1
berdirRelated I think: #1239370: Module updates of new modules in core are not executed
Comment #2
matason commentedI've run into this issue today, @DamienMcKenna did you discover a workaround?
Comment #3
czigor commentedSame issue with 7.37.
Comment #4
czigor commentedFalse alarm, I cannot see this in 7.37.
Comment #5
perennial.sky commentedI didn't replicate this issue in 7.37 version
Comment #6
dshumaker commentedI'm seeing this with Drupal 7.41......
---edit---
ha... actually after checking the parameters, my problem was that I was passing a string instead of an array to module_enable. false alarm. For all the googlers that land here - make sure you are passing an array and not just a string to module_enable. that fixed it for me. :)
Comment #7
David_Rothstein commentedI've definitely used this technique many times and never run into a problem with it either. Seems like we need steps to reproduce here?
Comment #8
cobadger commentedI experienced this problem just now - it turned out that one of the modules in my array to be enabled had an unmet dependency. Once I 'drush dl'-ed that module, the module_enable() statement in my db update worked as intended.