Skip to content

Instantly share code, notes, and snippets.

@q0rban
Created October 22, 2014 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save q0rban/3521f9c89d99c67d507c to your computer and use it in GitHub Desktop.
Save q0rban/3521f9c89d99c67d507c to your computer and use it in GitHub Desktop.
Enabling Drupal modules in an update hook
<?php
function hook_update_n() {
if (!drupal_check_module('foo')) {
throw new DrupalUpdateException('Foo does not have requirements needed to be enabled.');
}
module_enable(array('foo'));
return t('Enabled Foo module.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment