strongarm.install 838 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the strongarm module.
  5. */
  6. /**
  7. * Implements hook_enable().
  8. */
  9. function strongarm_enable() {
  10. // Weight strongarm exceptionally light.
  11. db_update('system')
  12. ->fields(array('weight' => -1000))
  13. ->condition('name', 'strongarm')
  14. ->condition('type', 'module')
  15. ->execute();
  16. }
  17. /**
  18. * Transition Strongarm variables from code to the database.
  19. */
  20. function strongarm_update_7201() {
  21. module_load_include('module', 'strongarm');
  22. $variables = strongarm_vars_load(TRUE, TRUE);
  23. if (!empty($variables)) {
  24. foreach ($variables as $var_name => $var) {
  25. $exists = db_query("SELECT name FROM {variable} WHERE name = :name", array(':name' => $var_name))->fetchField();
  26. if (!$exists) {
  27. variable_set($var_name, $var->value);
  28. }
  29. }
  30. }
  31. }