uc_googleanalytics.install 630 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_googleanalytics module.
  5. */
  6. /**
  7. * Implements hook_enable().
  8. */
  9. function uc_googleanalytics_enable() {
  10. // Get the weight of the Google Analytics module.
  11. $weight = db_query("SELECT weight FROM {system} WHERE name = :module", array(':module' => 'googleanalytics'))->fetchField();
  12. // Update the weight of the UC Google Analytics module so its hooks get called
  13. // after the actual Google Analytics module.
  14. db_update('system')
  15. ->fields(array('weight' => max(1000, $weight + 1)))
  16. ->condition('name', 'uc_googleanalytics')
  17. ->execute();
  18. }