Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. /**
  2. * Enable modules.
  3. * Normally we'd use master module for this but sometimes you can't run anything other than updb in production.
  4. */
  5. function mymodule_update_7001(&$sandbox) {
  6.  
  7. $modules = array(
  8. 'mymodule_one',
  9. 'mymodule_two',
  10. 'mymodule_three',
  11. );
  12.  
  13. if (!isset($sandbox['progress'])) {
  14. $sandbox['progress'] = 0;
  15. $sandbox['max'] = count($modules);
  16. }
  17.  
  18. $module = $modules[$sandbox['progress']];
  19. module_enable(array($module));
  20. drupal_flush_all_caches();
  21.  
  22. $sandbox['progress']++;
  23. $sandbox['#finished'] = $sandbox['progress'] / $sandbox['max'];
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement