title.install 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * Installation functions for the Title module.
  5. */
  6. /**
  7. * Helper function.
  8. */
  9. function _title_install_set_weight($weight) {
  10. db_update('system')
  11. ->fields(array('weight' => $weight))
  12. ->condition('name', 'title')
  13. ->execute();
  14. }
  15. /**
  16. * Implements hook_install().
  17. */
  18. function title_install() {
  19. // Make (reasonably) sure that title_module_implements_alter() is invoked as
  20. // last so we can determine the priority of our hook implementations reliably.
  21. _title_install_set_weight(100);
  22. }
  23. /**
  24. * Implements hook_update_N.
  25. *
  26. * Make sure Title has a very high weight to be able to perform reverse
  27. * synchronization reliably.
  28. */
  29. function title_update_7001() {
  30. _title_install_set_weight(100);
  31. }
  32. /**
  33. * Implements hook_update_N.
  34. *
  35. * Update title_auto_attach variables to the new format.
  36. */
  37. function title_update_7002() {
  38. $variables = array();
  39. foreach (variable_get('title_auto_attach', array()) as $variable) {
  40. $pieces = explode(':', $variable);
  41. $variables['title_' . $pieces[0]]['auto_attach'][$pieces[1]] = $pieces[1];
  42. }
  43. foreach ($variables as $name => $value) {
  44. variable_set($name, $value);
  45. }
  46. variable_del('title_auto_attach');
  47. }